We're Hiring!

Login from a Django App

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Login from a Django App

Postby icaoberg » Wed May 09, 2012 9:56 pm

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?
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Login from a Django App

Postby atarkowska » Tue May 15, 2012 1:22 pm

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
atarkowska
 
Posts: 327
Joined: Mon May 18, 2009 12:44 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest