Page 1 of 1

Login from a Django App

PostPosted: Wed May 09, 2012 9:56 pm
by icaoberg
I am creating a Django app that will retrieve some information from OMERO. I am currently looking for a way to tell the app that if

Code: Select all
if conn is None:
      #go to login page


what would be the best way to this?

Re: Login from a Django App

PostPosted: Tue May 15, 2012 1:22 pm
by atarkowska
If you checked out our code from git there is login_required decorator that does all the job for you

https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroWeb/omeroweb/decorators.py#L53

Code example:
Code: Select all
@login_required()
...
def my_view(request, conn=None, **kwargs):
    ...my implementation...


I hope it answers your question.

Ola