Re: m2m assignments lost when saving in admin but not shell

2011-08-17 Thread Matt Schinckel
I had similar problems, but I put it down to doing something 'unusual'.

Try setting a pdb breakpoint in your admin class, and see if there is 
anything odd. I found that I was getting failures due to save(commit=False) 
meaning that an object had no primary key, and I had to do some fancy stuff 
to replace the save_m2m method with one that handled my relationship.

Matt.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/KNtxJaZzTtIJ.
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.



m2m assignments lost when saving in admin but not shell

2011-08-17 Thread Shawn Milochik
I have some code that modifies related items when a model is saved. I've 
tried this by both using a post_save signal and by putting the code 
directly in a save() override.


When I save an instance in the Django admin, it never works.
When I save an instance in ./manage.py shell it always works.

Why would this be?

For instance, if my code (in the save override) is this:

self.some_m2m_field.clear()
self.some_m2m_field.add(this_thing)

Then if I go into the admin and save the instance, this_thing is not 
attached to the instance. But if I do a .save() in the shell and check 
it has been assigned.


I assume I'm missing something fundamental about this.

Thanks,
Shawn

--
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread michael kapelko
I.e. I want to set up database connection after Django app has started
*when I want it*.
Is there a way to do it?

-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread michael kapelko
Delphi application works with server based scripts over TCP. It can be
replaced with web interface.

I don't have several databases, I will use single one, it's
username/password that I want to use for everything Django does. So
essentially I want to only change 'USER', 'PASSWORD' in settings.py
after Django app started. I need those strings *dynamic*.
How do I accomplish this?

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



Performance of process_template_response for corporate branding

2011-08-17 Thread Nathan Hoad
I have a project at the moment that requires a lot of corporate
branding as well as internationalisation/translations etc. Basically
the way the system currently works is that it performs the
translations, then applies branding for specific distributors.

Now we're developing a web-based front end using Django, and of course
the same rules still apply. I have a solution at the moment that uses
a very minimalist middleware, which is called after the translations
are performed, using the process_template_response method.

Of course, it's working all fine, but I'm wondering about the
performance hit from what's essentially 10-20 of str.replace()
methods? The alternative is to create my own wrapper for Django's
translation package, but after looking at the code I'm not big on that
idea.

If anyone has any alternative solutions, don't hesitate to share!

-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread Mike Dewhirst

On 18/08/2011 11:23am, michael kapelko wrote:

I don't think the OP want to select which db is used, but to connect
to the db with the logged in user's credentials.

Exactly.


DB authentication and user authentication are separate things. Users authenticate 
against Django. Full stop. Django>  accesses the database using login data you 
provide on settings.py.

That's why I asked. I want to dynamically modifiy DB settings in
settings.py after user logged in with user credentials.


You could write a callable function to provide different database 
settings after Django has started but I suspect those settings are 
cached at startup. Might be a bit tricky to interfere with that.


OTOH if there are only a limited number of DBs you could put them all in 
settings.py and switch between them based on the collected credentials.




So far I have a Delphi app that asks user for username and password.
After he enters it and hits Enter, the application tries to connect to
the database with the provided credentials. All the permissions are
managed at database levels.
I want to remove Delphi app with Django app, so I need to login to
database with user credentials.


Delphi usually produces PC programs which rely on the Windows eco-system 
while Django doesn't. Not sure what you are trying to do. Can you 
describe your system?




Can you point me to the docs that deal with it?

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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread michael kapelko
> I don't think the OP want to select which db is used, but to connect
> to the db with the logged in user's credentials.
Exactly.

> DB authentication and user authentication are separate things. Users 
> authenticate against Django. Full stop. Django > accesses the database using 
> login data you provide on settings.py.
That's why I asked. I want to dynamically modifiy DB settings in
settings.py after user logged in with user credentials.

So far I have a Delphi app that asks user for username and password.
After he enters it and hits Enter, the application tries to connect to
the database with the provided credentials. All the permissions are
managed at database levels.
I want to remove Delphi app with Django app, so I need to login to
database with user credentials.

Can you point me to the docs that deal with it?

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: RPC for python functions in a Django project

2011-08-17 Thread Gelonida N
Hi Muhammad,


On 08/17/2011 08:18 PM, Muhammad Choudry wrote:
>  I've
> found that JSON-RPC is a good way to go for this, as there is
> typically built in support for this in javascript in addition to the
> numerous additional benefits.
> 
> I've seen several ways to do this:
> 1) Create a unique URI for each function that you would like to
> access:
> https://code.djangoproject.com/wiki/JSONRPCServerMiddleware
> 2) Create one point of access, and pass the method name in the JSON
> package.  In this particular example an SMD is automatically
> generated.
> https://code.djangoproject.com/wiki/Jsonrpc
> 
> The issue with (1) is that if there are many functions to be accessed,
> then there will be many URI's that will be used.  This does not seem
> like an elegant solution.  The issue with (2) is that I need to
> compare functions against a list of all functions.  Again this is not
> an elegant solution either.
> 
> Is there no way that we can take the advantages of (1) and (2) to
> create an interface such that:
>  - Only one URI is used as a point of access
>  - Functions are called directly (without having to be compared
> against a list of functions)
> 
> ?
> 
Did you look at rpc4django.

The way it works roughly:
- you add rpc4django to the installed apps
- in urls.py you create one uri for the rpc calls
- you simply decorate all functions, that should be available via RPC.

By default the function will be available as xmlrpc and jsonrpc function.

For more details: http://packages.python.org/rpc4django/setup.html




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



Re: Upload Multiple Images App ?

2011-08-17 Thread william ratcliff
We've done this using django and the fileapi--but it will only work with
HTML5 and modern browsers...The only other solution I know involves flash
 (I believe uploadify or swfupload)...

Best,
William

2011/8/17 枯藤天涯 

> to Kevin Monceaux,according to  Kevin's offering link,we must delete
> the underline file by ourselves,django is no longer doing this for
> us.I think you can write your own code to delete the files which is
> local  our your computer.And this is easy.By the way,this posy is very
> useful.It mentions almost  all  django apps which is about  image
> content.Thank  you fire-water.But I woder whether we can upload
> multiple images through ajax.Is there any tutorial about this?
>
> 2011/8/8 Kevin Monceaux 
> >
> > On Fri, Aug 05, 2011 at 10:31:38AM -0700, fire_water wrote:
> >
> > > and has a http://code.google.com/p/django-stdimage/
> > > issues/detail?id=22">known bug that does not delete images when
> > > its object/row is deleted.
> >
> > > According to django-imagekit's github.com page, it has the same  > > href="https://github.com/jdriscoll/django-imagekit/issues/16;>bug
> > > as django-stdimage.
> >
> > I suspect the above known bugs are related to a known bug in Django:
> >
> >
> https://Docs.DjangoProject.com/en/1.3/releases/1.2.5/#filefield-no-longer-deletes-files
> >
> > which many consider a feature instead of a bug.  :-)
> >
> >
> >
> > --
> >
> > Kevin
> > http://www.RawFedDogs.net
> > http://www.WacoAgilityGroup.org
> > Bruceville, TX
> >
> > What's the definition of a legacy system?  One that works!
> > Errare humanum est, ignoscere caninum.
> >
> > --
> > You received this message because you are subscribed to the Google 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.
> >
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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.



problem with a grph image in template

2011-08-17 Thread smartaz
good night and first my excuses for my English!!
after several research days I still do not succeed in solving a
probleme of billing of a graph generated with matplotlib and pil in
another view
to be more definite I have a view plot(request) which generates a
graph
 canvas.draw ()
 pil_image = PIL.Image.fromstring (' RGB ', canvas.get_width_height
(),
 canvas.tostring_rgb ())
 pil_image.save (buffer, ' PNG ')
 plt.close ()
 * Django' s HttpResponse reads the buffer and extracts the picture
 response = HttpResponse (buffer.getvalue (), content_type ='image /
png ')
 return response
if I call this view for an url: (r $' ^plot / image.png ', 'contact ')
which comes from a form where I put
 {% csrf_token %}
the graph is correctly displayed as picture in a page html
http: // 127.0.0.1:8000 / graphs / contact / image.png
If I pass by another view to show picture in a template Django,
I have an Internal Server Error 500 systematically by putting in the
template a simple tag  in the template
I tried everything in the second view: a simple to render
def show_graph (Request):
 return render_to_response (' Graphs / affichage.html ',
context_instance=RequestContext (request))
 I tried to remind of the function of view plo by returning the data
of the form
def show_graph (Request):
 request.session = request. POST
 session = SessionStore ()
 session.save ()
 response = contact (request)
 return render_to_response (' Graphs / affichage.html ',
context_instance=RequestContext (request))
I always have the same error.
Is what anybody can see that I hurt and that causes this error?
Thank you in advance

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



Re: How to load data from local static path in templates (security error)

2011-08-17 Thread Daniel Roseman
On Wednesday, 17 August 2011 19:00:13 UTC+1, Adam Zedan wrote:
>
> Hi it seems I cant access data from local static paths such as 
> c:\\somefolder\somefile.gif in my templates when I enter the url
> the code for my template is simplified to something like this
>
> 
> 
> 
> 
> Demo
> 
> 
> 
> 
> 
>
> The title change to Demo. which shows that the page has loaded but 
> I get the error in firefox saying:
> Security Error: Content at http://127.0.0.1:8000/db/ may not load or link 
> to file:///c://bender.gif
>


No, you can't do that. Why would you want to? Your users aren't going to 
have that file on their machines, so what's the point of referencing a local 
file path?

You serve the content through your webserver, with an http:// protocol. In 
development, you can do this through Django's development server:
https://docs.djangoproject.com/en/1.3/howto/static-files/
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/HtvmZxg0QJ4J.
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: Successfully Running Command Line Application from Django

2011-08-17 Thread octopusgrabbus
Thanks for the answer. It fixed the problem.

On Ubuntu it was www-data user  and on Red Hat Enterprise 5, it was
apache user, who were trying to write in amr's directory. I put each
user into amr's group on their respective systems. All is well.

On Aug 15, 4:26 pm, wayne  wrote:
> On Aug 15, 2:40 pm, octopusgrabbus  wrote:
>
> > I get a file permissions error, and this is running on Apache.
>
> > It's dying on the retrbinary line. However, it's logging in using
> > valid user names and passwords, so I'm confused as to why it's dying.
>
> Yes, but it looks as though you are passing a callback command to your
> ftp retrbinary() method that saves the file on your local filesystem
> (as expected).  I would bet that your django instance does not have
> permission to write to the directory that your server is trying to
> save the file to.  If the command line program is working outside of
> django, then the ftp setup is fine.  Test by setting the permissions
> of the directory you are saving to to something like 777.  If it
> works, that is your problem.

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



Re: GeoDjango Use

2011-08-17 Thread Ovnicraft
On Wed, Aug 17, 2011 at 1:06 PM, Dan H  wrote:

> how would I use geodjango to store geographic data in just one table
> of my database? can you import it as another app in a django project?
> or how would that work?
>

Geodjango is active by default, you just need inherit from correct class and
you will get tables with geofields defined.
You can read the doc in geodjango.org

Regards,

>
> --
> You received this message because you are subscribed to the Google 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.
>
>


-- 
Cristian Salamea
@ovnicraft

-- 
You received this message because you are subscribed to the Google 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: failed to load dll, what happened?

2011-08-17 Thread Andre Terra
Hello, thinke365,

First, please read https://code.djangoproject.com/wiki/UsingTheMailingList

Try running manage.py from a shell/prompt, not from the IDE.

See also
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/


Cheers,
AT

On Wed, Aug 17, 2011 at 2:03 PM, thinke365  wrote:

> i have created a django project using pydev, then i run manage.py,
> then error info such as failed to load dll comes out, what's wrong?
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread Andre Terra
DB authentication and user authentication are separate things. Users
authenticate against Django. Full stop. Django accesses the database using
login data you provide on settings.py.

If you're talking about permissions, Django ships with a permission module.
You can define custom permissions on your model's Meta attribute, and you
can check for them in your views, etc. If you want row level permissions,
add a created_by FK to User in your Model's and then check against that when
an object is present.


Cheers,
AT


On Wed, Aug 17, 2011 at 1:27 PM, michael kapelko  wrote:

> Still, how do i make all my models use the connection info logged in
> user provided?
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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: GeoDjango Use

2011-08-17 Thread Andre Terra
http://geodjango.org/presentations/

On Wed, Aug 17, 2011 at 3:06 PM, Dan H  wrote:

> how would I use geodjango to store geographic data in just one table
> of my database? can you import it as another app in a django project?
> or how would that work?
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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: need help regard to setup a web-hosting environment for Django

2011-08-17 Thread Andre Terra
*Best Right way to install django, python packages:*
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/

*Install nginx and serve django apps through fcgi:
*https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/*
*https://code.djangoproject.com/wiki/ServerArrangements
http://www.rkblog.rk.edu.pl/w/p/django-nginx/


Optionally, you could install apache and use nginx as a reverse proxy for
load balancing, but this is probably not what you need right now, so using
nginx "directly" should be enough.


Cheers,
AT

On Wed, Aug 17, 2011 at 3:25 PM, vikas ruhil  wrote:

> Hey I am using Ubuntu as My OS, hey want to setup a local web-hosting
> environment on my machine for a open source project for a django website ,
> so please any can help me in this how to setup i know set up a local web
> hosting of php not for python can anybody help me, I try about 20 times i
> failure in my attempt so any hint or idea how should i deploy , or nay
> tutorial or documentation plz
>
> --
> You received this message because you are subscribed to the Google 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.
>

-- 
You received this message because you are subscribed to the Google 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.



need help regard to setup a web-hosting environment for Django

2011-08-17 Thread vikas ruhil
Hey I am using Ubuntu as My OS, hey want to setup a local web-hosting
environment on my machine for a open source project for a django website ,
so please any can help me in this how to setup i know set up a local web
hosting of php not for python can anybody help me, I try about 20 times i
failure in my attempt so any hint or idea how should i deploy , or nay
tutorial or documentation plz

-- 
You received this message because you are subscribed to the Google 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.



RPC for python functions in a Django project

2011-08-17 Thread Muhammad Choudry
Hi,

I'm in the middle of trying to create a django website to access data
in a MySQL database.  The intenion is to also create a UI in Dojo
(javascript).  Also I would like the django backend will also provide
webservices (RPC for python functions) to allow access to the MySQL
database remotely.  So for example, if someone wants to use Perl
scripts to access the database (and additional functionality like
calculations based off of data in the database)  they can do so in
their native language.

Now ideally, the web services API is the same for javascript as well
as another remote service that wants to access these services.  I've
found that JSON-RPC is a good way to go for this, as there is
typically built in support for this in javascript in addition to the
numerous additional benefits.

I've seen several ways to do this:
1) Create a unique URI for each function that you would like to
access:
https://code.djangoproject.com/wiki/JSONRPCServerMiddleware
2) Create one point of access, and pass the method name in the JSON
package.  In this particular example an SMD is automatically
generated.
https://code.djangoproject.com/wiki/Jsonrpc

The issue with (1) is that if there are many functions to be accessed,
then there will be many URI's that will be used.  This does not seem
like an elegant solution.  The issue with (2) is that I need to
compare functions against a list of all functions.  Again this is not
an elegant solution either.

Is there no way that we can take the advantages of (1) and (2) to
create an interface such that:
 - Only one URI is used as a point of access
 - Functions are called directly (without having to be compared
against a list of functions)

?

-- 
You received this message because you are subscribed to the Google 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.



GeoDjango Use

2011-08-17 Thread Dan H
how would I use geodjango to store geographic data in just one table
of my database? can you import it as another app in a django project?
or how would that work?

-- 
You received this message because you are subscribed to the Google 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: Template html works when double clicked but empty when accessed through server

2011-08-17 Thread Adam Zedan
Are ou saying that the reason i get nothing when running through a url is
that because of security reasons (i.e) loading data from local machine ?? if
so could you tell me how i could solve that problem ??

On Tue, Aug 16, 2011 at 4:43 PM, Konstantin Sushenko wrote:

> you do not see anything because the style on your root element is set
> to "display:none" and the browser does not run scripts because they
> are loaded from local URLs. as it says: it is a insecure to execute
> scripts from local URLs. suppose you publish this page on your
> production server, where would your visitors get there scripts? they
> are not on their machines in "d:/django-1.3...". basically, it is
> unclear to me what you are trying to achieve.
>
> konstantin
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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.



failed to load dll, what happened?

2011-08-17 Thread thinke365
i have created a django project using pydev, then i run manage.py,
then error info such as failed to load dll comes out, what's wrong?

-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread bruno desthuilliers
On 17 août, 18:37, Tom Evans  wrote:
> On Wed, Aug 17, 2011 at 5:27 PM, michael kapelko  wrote:
> > Still, how do i make all my models use the connection info logged in
> > user provided?
>
> You can't, or at least not with stock django. The term you are looking
> for is 'multi tenancy', where by the database used is dependent upon
> the user who is logged in.

I don't think the OP want to select which db is used, but to connect
to the db with the logged in user's credentials.


-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread Tom Evans
On Wed, Aug 17, 2011 at 5:27 PM, michael kapelko  wrote:
> Still, how do i make all my models use the connection info logged in
> user provided?
>

You can't, or at least not with stock django. The term you are looking
for is 'multi tenancy', where by the database used is dependent upon
the user who is logged in.

I'm sure google can find you a project or two dealing with "django
multi tenancy".

Cheers

Tom

-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread michael kapelko
Still, how do i make all my models use the connection info logged in
user provided?

-- 
You received this message because you are subscribed to the Google 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: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread Shawn Milochik
It's just Python. Use the sqlite3 module or psycopg2 (or whatever's 
appropriate) and use your databases as you like.


There's nothing stopping you from using any tables in whatever database 
Django's models are using, or any other databases of any kind from 
within your Python code.


There's no conflict between any of that and Django's own database 
connection, so there's no need to prevent Django's own connection 
happening upon the launch of your Django 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.



How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread michael kapelko
Hi.
I want to have a login form, and connect to DB with the provided
username/password.
Django's settings.py specifies username/password/DB to use for the
whole Django app. I want to defer the DB connection when a user
actually logins, not when Django starts up.
Is there a way to do it?
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: Cascading Deletes on ManyToManyField

2011-08-17 Thread ollie
class Item(models.Model):
tags = models.ManyToManyField(Tag, through=Tagging)
...

class Tag(models.Model):
...

class Tagging(models.Model):
item = models.ForeignKey(Item)
tag = models.ForeignKey(Tag)
...

tagging = Tagging.objects.get(item=item1, tag=tag1)
tagging.delete() # then tag1 of item1 is deleted

On 8月17日, 下午7时12分, Jeremy Keeshin  wrote:
> I have an Item model that has many Tags. If I delete a Tag, I want to make
> sure the related Items are not deleted. I tested this out on my local
> database, and it seems that there are no cascading deletes with many to many
> fields. However, I previously deleted data accidentally with ForeignKeys
> because I did not understand cascading deletes, so I just want to make
> sure.
>
> I read in the docs that you can customize the on_delete behavior in Django
> 1.3, but I am not quite clear how this applies to ManyToMany fields. What is
> the delete behavior on ManyToManyFields?
>
> Thanks,
> Jeremy

-- 
You received this message because you are subscribed to the Google 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: Cascading Deletes on ManyToManyField

2011-08-17 Thread Jacob Kaplan-Moss
On Wed, Aug 17, 2011 at 6:12 AM, Jeremy Keeshin  wrote:
> I have an Item model that has many Tags. If I delete a Tag, I want to make
> sure the related Items are not deleted. I tested this out on my local
> database, and it seems that there are no cascading deletes with many to many
> fields. However, I previously deleted data accidentally with ForeignKeys
> because I did not understand cascading deletes, so I just want to make
> sure.

Yes, this is correct -- foreign keys cascade deletes by default; many
to many fields don't.

Jacob

-- 
You received this message because you are subscribed to the Google 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.



Cascading Deletes on ManyToManyField

2011-08-17 Thread Jeremy Keeshin
I have an Item model that has many Tags. If I delete a Tag, I want to make
sure the related Items are not deleted. I tested this out on my local
database, and it seems that there are no cascading deletes with many to many
fields. However, I previously deleted data accidentally with ForeignKeys
because I did not understand cascading deletes, so I just want to make
sure.

I read in the docs that you can customize the on_delete behavior in Django
1.3, but I am not quite clear how this applies to ManyToMany fields. What is
the delete behavior on ManyToManyFields?

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google 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: formfield_for_foreignkey field.name-generic

2011-08-17 Thread Tom Evans
On Wed, Aug 17, 2011 at 8:54 AM, andrepar  wrote:
> How can apply DRY to the following lines?
>
> def formfield_for_foreignkey(self, db_field, request, **kwargs):
>        if db_field.name == "field1":
>            kwargs["queryset"] =
> Field1.objects.filter(owner=request.user)
>            return super(MyModelAdmin,
> self).formfield_for_foreignkey(db_field, request, **kwargs)
>        if db_field.name == "field2":
>            kwargs["queryset"] =
> Field2.objects.filter(owner=request.user)
>            return super(MyModelAdmin,
> self).formfield_for_foreignkey(db_field, request, **kwargs)
>
>        ...
>
> Andrea
>

Use a factory:

def formfield_for_foreignkey(self, db_field, request, **kwargs):
factory = {
'field1': Field1.objects,
'field2': Field2.objects,
}
kwargs['queryset'] = factory[db_field.name].filter(owner=request.user)
return super(MyModelAdmin,
self).formfield_for_foreignkey(db_field, request, **kwargs)

-- 
You received this message because you are subscribed to the Google 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: How to display Scientific Notation for a field on the admin pages?

2011-08-17 Thread 枯藤天涯
I think you can add a method in the class .when you want to display
the scientific notation on the admin pages ,just call the
instance.method.and  that is ok.

2011/8/5 Jeremy Dunck :
> On Tue, Aug 2, 2011 at 12:32 PM, DjangoOfWar  wrote:
>> Right now I have a Decimal field in my model but I'd like it to
>> display as scientific notation on the admin pages.
>>
>> Do I need to make a custom model field, that uses a custom form field
>> or is there an easier way?
>>
>> (I'm on Django 1.2 if it matters)
>
> What you want is a ModelAdmin which declares formfield_overrides to
> map the model Field to a custom widget:
> https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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: Djangonaut is looking for a job

2011-08-17 Thread 枯藤天涯
hello,I am from China。And I am looking a job about python/django .Just
same as you .Remote (telecommuting) only.Can we find the job like
this?

2011/8/5 Eugeny Belykh :
> Hi everybody.I am Django newbee based in Russia. I am looking for a
> Django related job.Remote (telecommuting) only. 1 django-powered site
> in portfolio.Are there any vacancies?
>
> --
> You received this message because you are subscribed to the Google 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.
>
>

-- 
You received this message because you are subscribed to the Google 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: How to make Django not prefix columns with table name?

2011-08-17 Thread bruno desthuilliers
On 17 août, 09:57, kornerr  wrote:
> Hi.
> I use oracle django backend, and access foreign scheme tables. The
> prefixing invalidates my queries.
> How can the prefixing be turned off?

https://docs.djangoproject.com/en/1.3/ref/models/options/#db-table

You may be interested in the 'managed" option too:

https://docs.djangoproject.com/en/1.3/ref/models/options/#managed

-- 
You received this message because you are subscribed to the Google 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: Upload Multiple Images App ?

2011-08-17 Thread 枯藤天涯
to Kevin Monceaux,according to  Kevin's offering link,we must delete
the underline file by ourselves,django is no longer doing this for
us.I think you can write your own code to delete the files which is
local  our your computer.And this is easy.By the way,this posy is very
useful.It mentions almost  all  django apps which is about  image
content.Thank  you fire-water.But I woder whether we can upload
multiple images through ajax.Is there any tutorial about this?

2011/8/8 Kevin Monceaux 
>
> On Fri, Aug 05, 2011 at 10:31:38AM -0700, fire_water wrote:
>
> > and has a http://code.google.com/p/django-stdimage/
> > issues/detail?id=22">known bug that does not delete images when
> > its object/row is deleted.
>
> > According to django-imagekit's github.com page, it has the same  > href="https://github.com/jdriscoll/django-imagekit/issues/16;>bug
> > as django-stdimage.
>
> I suspect the above known bugs are related to a known bug in Django:
>
> https://Docs.DjangoProject.com/en/1.3/releases/1.2.5/#filefield-no-longer-deletes-files
>
> which many consider a feature instead of a bug.  :-)
>
>
>
> --
>
> Kevin
> http://www.RawFedDogs.net
> http://www.WacoAgilityGroup.org
> Bruceville, TX
>
> What's the definition of a legacy system?  One that works!
> Errare humanum est, ignoscere caninum.
>
> --
> You received this message because you are subscribed to the Google 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.
>

-- 
You received this message because you are subscribed to the Google 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.



How to make Django not prefix columns with table name?

2011-08-17 Thread kornerr
Hi.
I use oracle django backend, and access foreign scheme tables. The
prefixing invalidates my queries.
How can the prefixing be turned off?
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.



formfield_for_foreignkey field.name-generic

2011-08-17 Thread andrepar
How can apply DRY to the following lines?

def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "field1":
kwargs["queryset"] =
Field1.objects.filter(owner=request.user)
return super(MyModelAdmin,
self).formfield_for_foreignkey(db_field, request, **kwargs)
if db_field.name == "field2":
kwargs["queryset"] =
Field2.objects.filter(owner=request.user)
return super(MyModelAdmin,
self).formfield_for_foreignkey(db_field, request, **kwargs)

...

Andrea

-- 
You received this message because you are subscribed to the Google 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_for_foreignkey

2011-08-17 Thread andrepar
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "field1":
kwargs["queryset"] =
Field1.objects.filter(owner=request.user)
return super(MyModelAdmin,
self).formfield_for_foreignkey(db_field, request, **kwargs)
if db_field.name == "field1":
kwargs["queryset"] =
Field1.objects.filter(owner=request.user)
return super(MyModelAdmin,
self).formfield_for_foreignkey(db_field, request, **kwargs)

-- 
You received this message because you are subscribed to the Google 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: How to Layout a Django Application?

2011-08-17 Thread Andre Lopes
Obrigado André(Thank you André),

I have read about the templates. Seems easy.

Continue with the learning...

Regards,


On Tue, Aug 16, 2011 at 2:04 PM, Andre Terra  wrote:
> There are no particular layouts, but sometimes writing an inclusion tag[1]
> can help with abstracting some of the logic from the template (especially in
> the case of side columns that can vary based on context).
>
> What I usually do:
>
> Write a base.html file with some "default" data, including dummy content
> text wrapped around something like a context block, eg.
>
> 
> {% block content %}
>   No content yet.
> {% endblock %}
>
> 
> {% extends 'base.html' %}
>
> {% block content %}
>   My content
> {% endbock %}
>
>
> I also have blocks for javascript, styles and extrahead, which usually are
> called with {{ block.super }} in a specific template, so that I can append
> more scripts to a section of the site rather than having to rewrite the
> entire block.
>
> Let us know if you need more help!
>
>
> Cheers,
> AT
>
> [1]
> https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags-inclusion-tags
>
>
> On Tue, Aug 16, 2011 at 2:46 PM, Andre Lopes  wrote:
>>
>> Hi, another question from a Django beginner.
>>
>> I have played with views and templates a little bit, but now I want to
>> make a real layout(Header, Side Column and Footer). There are any
>> guides on layouts that I should follow? There are Apps that will help
>> me with that task?
>>
>> Please le me know.
>>
>> Best Regards,
>>
>> --
>> You received this message because you are subscribed to the Google 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.
>>
>
> --
> You received this message because you are subscribed to the Google 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.
>

-- 
You received this message because you are subscribed to the Google 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.



Problem with translations

2011-08-17 Thread Isaac

Hi folks,

I'm having a problem with a single module and its translations.

This module has some lazy translation (the same as other modules), but 
in admin, it spreads an error.

Error is the following:

TemplateSyntaxError at /admin/tieredpricing/pricingtier/add/
Caught TypeError while rendering: Lazy object returned unexpected type.
Request Method:GET
Request URL:http://localhost:8000/admin/tieredpricing/pricingtier/add/
Django Version:1.3
Exception Type:TemplateSyntaxError
Exception Value:
Caught TypeError while rendering: Lazy object returned unexpected type.
Exception Location:
/usr/local/lib/python2.7/dist-packages/django/utils/functional.py in 
__wrapper__, line 197

Python Executable:/usr/bin/python
Python Version:2.7.1

In template 
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/includes/fieldset.html, 
error at line 6

Caught TypeError while rendering: Lazy object returned unexpected type.
1 
2{% if fieldset.name %}{{ fieldset.name }}{% endif %}
3{% if fieldset.description %}
4 {{ fieldset.description|safe }}
5{% endif %}
6{% for line in fieldset %}

At line 6.

Then I traced that error to its dispatcher, and I found the following:

at line 402 of file django/forms/forms.py there is the following line:
self.help_text = field.help_text or ''

my problem is that field.help_text must contain an unicode string (u'') 
and not that weird object that is containing,



I've found a way to solve it, and is to call __unicode__() function on 
that object, that explicitly gives me the right unicode string, but that 
code is django core, and I don't know if it's a django issue.


Can anybody help me plz?

Thanks in advance

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



Re: 3rd party Apps in Django

2011-08-17 Thread Derek
Chris

"Dingo" projects?  Is that what they call them in Australia ;)

On Aug 16, 12:54 am, Chris Lawlor  wrote:
> +1 for using virtualenv. Indispensable for working on more than one dingo 
> project on the same development machine. If you're developing on Linux or 
> Mac, take a look at virtualenvwrapper. It makes working with virtual 
> environments practically painless.

-- 
You received this message because you are subscribed to the Google 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.