Re: show ldap attributes in django

2012-03-16 Thread Marc Patermann

Hi,

Marc Patermann schrieb (15.03.2012 16:39 Uhr):


And a template:

{{ text }}

Which gives a dictionary with values of lists where most of the list 
have only one value. I can access single of them by {{ text.mail }} or 
{{ text.mail }}.


My goal is to show whatever attribute there is with its values.
Can you point me in the right directions to achieve this?
I found some hints at 
http://groups.google.com/group/django-users/browse_thread/thread/6f1b957dc5341fbe/4e297f2c9d960fee


Now I have

{% for key in text.items %}
  Attribut Nr. {{ forloop.counter }} {{ key.0 }} hat
  {% for value in  key.1 %}
Wert {{ value }} 
  {% endfor %}
{% endfor %}

in my template, which is fine for now.


Marc

--
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.



show ldap attributes in django

2012-03-15 Thread Marc Patermann

Hi,

I started to learn Django recently, read the tutorial and Django Book etc.
My Goal is to make the functionality of a few system cli scripts for 
ldap and mail available in the web.


I started with a simple existing ldap script that displays attributes of 
an object.

Now I tried to integrate this in a view.

def myattrs(request, myobject):
  object_id = myobject
  con(s_as="cn=human,ou=foo",s_with="password")
  dn,entry = suche(sfilter="(&(mail=foo*)(objectclass=inetorgperson))")
  text = "Mail is %s" % entry['mail'][0]
  return render_to_response('myobject/details.html',{'text' : entry})

And a template:

{{ text }}

Which gives a dictionary with values of lists where most of the list 
have only one value. I can access single of them by {{ text.mail }} or 
{{ text.mail }}.


My goal is to show whatever attribute there is with its values.
Can you point me in the right directions to achieve this?


Marc

--
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.