It's possible but you may need to split out django and non-django into a front and back end. This sounds similar to phpmyadmin or phppgadmin

I think the key to this is that django only be used to store the user and connection information for each database (And provide a web interface). When a user goes to execute SQL, it should be sent via psycopg to pg and the data returned and parsed into an object you can then pass into a django page.

So basically you can use the django ORM for the arbitrary sql you want to execute on an given database since that needs to occur with a specific user/connection information.

This is similar to how pgAdmin works, the big difference here is that you're abstracting so that people work over port 80 instead of having them direct connect to the db.

Enjoy,
Alex

On 04/17/2013 12:16 AM, Maximilian Tyrtania wrote:


Am Dienstag, 16. April 2013 17:52:11 UTC+2 schrieb אברהם סרור:

So you are saying that each user models will be using the same database
but with different connection settings?


Yes, exactly. Each user has his own username. That's what the SQL command
"create user xy" is for exactly. I don't think my approach is overly
exotic, if I may say so. It enables the db admin to use the finely grained
permissions model of the database and grant or revoke permissions
individually. I realize django can do the same thing, but I don't want to
"copy" my database permissions setup over to django and make sure it's in
sync.


I believe you can create each and every connection setting on your
databases inside settings.py, each one would use the same database but a
different user.
When creating an object specify it to use the corresponding database


Yeah, I realize that this is possible, but this approach, as far as I can
see, comes down to being quite a maintenance burden as I need to have each
and every user (and I got many, >500) be represented in my settings file.
So, am I out of luck?
Thanks,

Max



On Tue, Apr 16, 2013 at 5:27 PM, Maximilian Tyrtania <
maximilia...@googlemail.com <javascript:>> wrote:

I looked at that a bit, thanks, the problem is that I can well use my pg
server to do the authentication, but I still can't talk django into using
the database connection for this particurlar user (hopefully I'm just not
aware of the solution).
You see, lots of my models in models.py are based on database views in
postgres, which in turn make use of the current_user() function. This is
why I need django to use the correct connection settings.

Am Dienstag, 16. April 2013 14:51:18 UTC+2 schrieb אברהם סרור:

I believe you could create a custom auth that relies on the postgres
auth system

  --
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to django-users...@googlegroups.com <javascript:>.
To post to this group, send email to django...@googlegroups.com<javascript:>
.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.







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


Reply via email to