On Fri, Sep 4, 2009 at 1:31 PM, Ulf Kronman wrote:
>
> Hi all,
>
> I’m using Django to build an Intranet web interface to a big legacy
> database running in a MS SQL Server.
> With the help of the code from the guys over at the django_pyodbc
> project (http://code.google.com/p/django-pyodbc/) I have managed to
> get things working quite well against this “alien” database manager.
> In a local copy of the legacy database on my Windows laptop I can
> browse and update records, using both my own forms and the admin
> interface.
>
> Now I want to move the web interface to an Ubuntu Linux server that is
> supposed to act as an Intranet web interface against the MS SQL
> database. I have my own forms working for updating from the Linux web
> to the MS server, but I would also like to make use of the excellent
> Django admin interface for managing data on the server.
>
> The problem I’m facing here is that I’m not in charge of the legacy
> database, and I can’t get the rights to install the tables for
> authorisation, sessions and content management that the Django admin
> interface seems to be dependent on.
>
> I have been fiddling with multi database management with a bit of
> luck, (thanks to
> http://www.mechanicalgirl.com/view/multiple-database-connection-a-simple-use-case/
> and http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/),
> the idea being to have a local PostgreSQL on the Linux box as the
> default database for the tables needed by Django admin and switching
> over to the MS database for the actual data handling. Browsing and
> reading works fine, but I can’t get the multi-db management to work
> properly for updating of records on the MS SQL Server. This may be due
> to the non-supported code for MS SQL doing non-standard requests or to
> my lack of knowledge.
>
> So, my bottom line question is: Is there by chance any way to turn off
> authorisation in the Django admin or is there a way I could clone the
> functionality of the admin interface and use it without authorisation,
> sessions and content management, so that it won’t need to access any
> of the auth_ or django_ tables in the database?
There isn't a simple switch of setting to do this out-of-the-box.
However, it _might_ be possible with some creative subclassing.
The admin site is just an instance of the AdminSite class. This class
can be subclassed if you want to.. For example, you could remove all
login requirements by overriding the has_permission() method to return
True without reference to the User table.
The ModelAdmin class can also be subclassed - this class exposes a few
more methods that would need to be overridden - again, permissions
methods (has_add_permission, has_change_permission,
has_delete_permission), plus some logging methods (log_addition,
log_change, log_deletion) and message sending methods (message_user)
Caveat: I haven't tried any of this, so I might be completely wrong.
You're in unexplored territory, so you're probably going to need to do
some code spelunking to make it work and find all the places that the
auth_ and django_ tables are used.
Yours,
Russ Magee %-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---