Templating

20 views
Skip to first unread message

Ashley McNamara

unread,
Apr 9, 2014, 4:03:47 PM4/9/14
to django-a...@googlegroups.com
Hey Mark, 

So I am wondering if there's any documentation that explains how I would pull information I get from Allaccess and distribute it through my templates? I know that's a silly question.. I am a new developer. 

Mark Lavin

unread,
Apr 9, 2014, 5:00:36 PM4/9/14
to django-a...@googlegroups.com
What information are you trying to get? The list of active providers can be added and accessed using the context processor: allaccess.context_processors.available_providers. You can fetch profile info or make other API calls using the access.api_client https://django-all-access.readthedocs.org/en/v0.6.X/api-access.html

There are examples in the example project: https://github.com/mlavin/django-all-access/blob/master/example/example/views.py

I looks like the v0.6 docs weren't being built but I've update Read the Docs to ensure they are available.


On Wed, Apr 9, 2014 at 4:03 PM, Ashley McNamara <ashleym...@gmail.com> wrote:
Hey Mark, 

So I am wondering if there's any documentation that explains how I would pull information I get from Allaccess and distribute it through my templates? I know that's a silly question.. I am a new developer. 

--
You received this message because you are subscribed to the Google Groups "django-all-access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-all-acc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ashley McNamara

unread,
Apr 9, 2014, 5:57:17 PM4/9/14
to django-a...@googlegroups.com
I guess I could have been more clear in my question, huh? Still shaky on the whole thing so it's hard for me to phrase in a way that doesn't sound really stupid... Ok so, I went through the tutorial and looked at the examples and used some of the code from the example to test and it spits out this lovely json (attached photo) but obviously it's not user friendly and I am not sure where to start to write it in a way that spits it out in a user friendly way. Again, I feel super dumb right now. HA! 
Screen Shot 2014-04-09 at 2.54.22 PM.png

Mark Lavin

unread,
Apr 9, 2014, 7:49:47 PM4/9/14
to django-a...@googlegroups.com
In the example all of the user profile information (which as you noted is JSON) is added to the template context as ``info``


The template simply renders this using ``pprint``


If instead you wanted to show specific pieces of information you could access them like attributes in the template such as ``{{ info.description }}``. The format of this ``info 

Mark Lavin

unread,
Apr 9, 2014, 7:51:43 PM4/9/14
to django-a...@googlegroups.com
Whoops hit send too fast...

The format of this ``info`` depends on the provider which the user authenticated with. If you are allowing for multiple providers you would probably have an easier time processing this in the view and normalizing some of the key names before passing to the template. I hope that gets you on the right track.

Best,

Mark

Ashley McNamara

unread,
Apr 10, 2014, 1:01:29 PM4/10/14
to django-a...@googlegroups.com
Extra helpful! Thank you!!
Reply all
Reply to author
Forward
0 new messages