Re: Problem with AD (LDAP) authentication
Have discovered what works - but it goes against the docs... I needed to set User.is_active = True. The permissions for admin (has_perm) appears to check this flag and returns False for inactive users. Problem solved. On Jul 9, 10:15 am, TechnicalBard <rodwe...@gmail.com> wrote: > Alas - that doesn't make a difference... > > On Jul 8, 4:29 pm, Frédéric Hébert <fg.heb...@gmail.com> wrote: > > > > > Hi, > > > Maybe, should you put is_staff=True : > > >http://docs.djangoproject.com/en/dev/topics/auth/#users > > > Regards, > > > Frédéric > > > 2009/7/8 Technicalbard <rodwe...@gmail.com>: > > > > I'm trying to write an Active Directory / LDAP authenication, and I'm > > > having problems. The code is at:http://dpaste.com/hold/64752/ > > > > When I set this authentication and then try to go > > > tohttp://localhost:8000/admin > > > and login to the development server, it authenticates against the LDAP > > > server (the print statements indicate as such in the django console), > > > and it does create a new django user in the database. But it doesn't > > > redirect me to the admin interface. It brings back the login screen > > > with the error message: > > > > Please enter a correct username and password. Note that both fields > > > are case-sensitive. > > > > Except I know that I did because the database was updated. What am I > > > doing wrong? > > > --http://www.openidfrance.fr/fhebert --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with AD (LDAP) authentication
Alas - that doesn't make a difference... On Jul 8, 4:29 pm, Frédéric Hébert <fg.heb...@gmail.com> wrote: > Hi, > > Maybe, should you put is_staff=True : > > http://docs.djangoproject.com/en/dev/topics/auth/#users > > Regards, > > Frédéric > > 2009/7/8 Technicalbard <rodwe...@gmail.com>: > > > > > > > > > I'm trying to write an Active Directory / LDAP authenication, and I'm > > having problems. The code is at:http://dpaste.com/hold/64752/ > > > When I set this authentication and then try to go > > tohttp://localhost:8000/admin > > and login to the development server, it authenticates against the LDAP > > server (the print statements indicate as such in the django console), > > and it does create a new django user in the database. But it doesn't > > redirect me to the admin interface. It brings back the login screen > > with the error message: > > > Please enter a correct username and password. Note that both fields > > are case-sensitive. > > > Except I know that I did because the database was updated. What am I > > doing wrong? > > --http://www.openidfrance.fr/fhebert --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with AD (LDAP) authentication
I'm trying to write an Active Directory / LDAP authenication, and I'm having problems. The code is at: http://dpaste.com/hold/64752/ When I set this authentication and then try to go to http://localhost:8000/admin and login to the development server, it authenticates against the LDAP server (the print statements indicate as such in the django console), and it does create a new django user in the database. But it doesn't redirect me to the admin interface. It brings back the login screen with the error message: Please enter a correct username and password. Note that both fields are case-sensitive. Except I know that I did because the database was updated. What am I doing wrong? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Efficiency of getting attribute values in templates
But the admin app does - it defines the labels from the attribute names and just puts them all in a table or list. How does one do that? Analogous to iterating through a list of objects, is it possible to iterate through the attributes of a single object? On Jul 4, 5:32 pm, Rajesh D <rajesh.dha...@gmail.com> wrote: > On Jul 4, 6:30 pm, TechnicalBard <rodwe...@gmail.com> wrote: > > > Is there a way to pass an object to the template and have the template > > handle all of the attributes without hardcoding them into the > > template? > > Depends on what you mean by "handle". The template won't by itself > know the markup with which you want to wrap your object's various > attributes. > > -RD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Efficiency of getting attribute values in templates
Is there a way to pass an object to the template and have the template handle all of the attributes without hardcoding them into the template? On Jul 3, 10:04 am, Rajesh Dwrote: > On Jul 3, 9:17 am, Nikola Pavlović wrote: > > > > > > > Hello people, > > > I'm writing my first Django application and would like to know what is > > considered more efficient: getting values of models' attributes in views > > or directly in templates? > > > More precicely, say we have a Person model with name and id attributes, > > and these need to be shown on a page. > > > Is it better for a view to "prepare" a context like this: > > > # views.py > > # ... > > > persons = [] > > > for person in Person.objects.all(): > > persons.append({'id': person.id, 'name': person.name}) > > > return render_to_response('some_template.html', persons) > > > # some_template.html > > > {% for p in persons %} > > Id: {{ p.id }}; Name: {{ p.name }} > > {% endfor %} > > > or just pass a QuerySet in a context like this: > > # views.py > > # ... > > > persons = Person.objects.all() > > return render_to_response('some_template.html', persons) > > > and then let the template access attribute values directly? > > > Does it make a difference in terms of performance? > > The second method avoids an extra loop and also keeps your code leaner > (less code == lesser chances of bugs). It's also the more commonly > used method. And if you are displaying just a handful of persons per > page, the performance differences should be negligible either way. If > you have a lot of persons in that query set, you will want to use some > kind of pagination anyway. > > -RD --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How does admin generate HTML for adding objects?
Thanks! Related question: when displaying a ModelForm, how does Django iterate/enumerate how many fields the model has? On Jul 3, 1:16 am, Jonathan Buchanan <jonathan.bucha...@gmail.com> wrote: > On Fri, Jul 3, 2009 at 6:06 AM, TechnicalBard<rodwe...@gmail.com> wrote: > > > To clarify, the djangobook states: > > > << On the admin site’s edit forms, each field’s label is generated > > from its model field name. The algorithm is simple: Django just > > replaces underscores with spaces and capitalizes the first character, > > so, for example, the Book model’s publication_date field has the label > > “Publication date.” >> > > > Where in the django.contrib.admin code is this logic found? I would > > like to utilize it. > > This is part of the forms library - django.forms.forms.pretty_name [1] > is used [2] to generate a label from the field name if a label was not > given when the field was instantiated. > > Jonathan. > > [1]http://code.djangoproject.com/browser/django/trunk/django/forms/forms... > [2]http://code.djangoproject.com/browser/django/trunk/django/forms/forms... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How does admin generate HTML for adding objects?
To clarify, the djangobook states: << On the admin site’s edit forms, each field’s label is generated from its model field name. The algorithm is simple: Django just replaces underscores with spaces and capitalizes the first character, so, for example, the Book model’s publication_date field has the label “Publication date.” >> Where in the django.contrib.admin code is this logic found? I would like to utilize it. On Jul 2, 4:02 pm, Technicalbard <rodwe...@gmail.com> wrote: > I'm curious how the admin creates the templates for any object in the > database... > > I'm using the object_detail generic view, but would prefer having > Django use the parameters of the object to generate the template, > rather than me having to hardcode the parameter names into the > template. > > The admin does this when you create new objects - how? The docs don't > seem to lead me to this. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How does admin generate HTML for adding objects?
I'm curious how the admin creates the templates for any object in the database... I'm using the object_detail generic view, but would prefer having Django use the parameters of the object to generate the template, rather than me having to hardcode the parameter names into the template. The admin does this when you create new objects - how? The docs don't seem to lead me to this. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with generic views
Hey all, I did the tutorial, yet when I try to apply what I've learned (or think I've learned), to my own application it doesn't work... My code looks like this: # taskmgr/models.py class Task(models.Model): name = models.CharField(max_length=216) summary = models.CharField(max_length=3072, blank=True) origin = models.CharField(max_length=96, blank=False) # more stuff # taskmgr/urls.py from django.conf.urls.defaults import * from django.views.generic import list_detail from mysite.taskmgr.models import Task urlpatterns = patterns('taskmgr.views', url(r'^$', list_detail.object_list, { "queryset" : Task.objects.all() }, name="task_list"), # more urls # task_list.html This is the task list {% for object in Task.object.all %} {{ object.id }} -- {{ object.name }} is due: {{ object.date_comp_req }} {% endfor %} I know it is picking up the template, because it displays the text in the line But it displays nothing else. If I do this in the shell: >>>p = Task.objects.get(pk=1) [, ] >>>p.name u'Build Task Manager' So I know that Task.objects gets me something... What do I need to change to pass this to the template properly... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Where to put form definitions?
My reading of the documentation isn't clear on where form definitions could or should be defined. Is it better to define forms inside an apps views.py file, or should I put the form definitions into a separate forms.py file and import it into the views as necessary? The latter seems more reusable. Does anyone have reasons to do otherwise? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with startproject
django-admin is executable. The problem appears to be that django- admin doesn't have rights to the target directory... On Jun 2, 11:52 am, James Bennett <ubernost...@gmail.com> wrote: > On Tue, Jun 2, 2009 at 12:46 PM, Technicalbard <rodwe...@gmail.com> wrote: > > The problem comes when I try to start the tutorial: > > > mor...@morgan-laptop:~/www$ django-admin startproject mysite > > Error: [Errno 13] Permission denied: '/home/morgan/www/mysite' > > Quoting the tutorial: > > "you may see the message “permission denied” when you try to run > django-admin.py startproject. This is because, on Unix-based systems > like OS X, a file must be marked as “executable” before it can be run > as a program. To do this, open Terminal.app and navigate (using the cd > command) to the directory where django-admin.py is installed, then run > the command chmod +x django-admin.py." > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with startproject
OK - newb here (in more ways than one). I'm trying to get going on an Ubuntu VM (inside VirtualBox) and I installed Django via synaptic. The problem comes when I try to start the tutorial: mor...@morgan-laptop:~/www$ django-admin startproject mysite Error: [Errno 13] Permission denied: '/home/morgan/www/mysite' I made sure that I have ownership of the /www folder (as opposed to root having ownership), but that didn't make a difference. Help! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
New Project - want advice
Hi, I'm planning a new project, and I want the following feature set (eventually). It will of course be rolled out in parts as apps are completed. The purpose of this is to manage knowledge in various domains. - wiki-type knowledge-base with full audit trail - threaded forum - embedding pdf / svg / png images in wiki/forum - attaching and safely storing native format files associate with wiki/forum items. - task manager to identify and assign issues that need resolving in the knowledgebase. - need to have ACL-type user access, editing and moderating levels and granular permissions on wiki articles / forum messages that are assignable by a moderator from a web-interface. - email alerts to users - ideally, login authentication will use existing Active Directory. So my request for advice is: What django-apps are available that could use to provide some of this functionality, or at least use as a starting point to develop the functionality? Can anyone point me to demos/examples of similar functionality? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
MySQLdb for Python 2.6 on win32
If you are looking for this, I compiled it using MSVC++2008 Express, against MySQL 5.0.67 using Python 2.6 and the MySQLdb 1.2.2 source: http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe Hope it helps anyone who was looking. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Building local Django docs as HTML on Win32?
OK - figured this out by myself. - Need the Gnuwin32 version of make - then need to install sphinx and all it's dependencies. Simple with easy_install - then edit Makefile to adjust it to handle win32 commands, primarily the use of backslashes: On Unix/Linux: mkdir -p _build/html _build/doctrees On win32: mkdir _build\html _build\doctrees and change this line: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build\html to use backslash instead of forward slash in the path at the end. And then it works like it should. On Jan 31, 1:50 pm, Technicalbard <rodwe...@gmail.com> wrote: > I've found a number of places on the net that tell me how to build > myself a copy of Django documentation from the Restructured Text > format, but they are all for Linux / BSD. > > Any advice on how to do this on Windows without Cygwin? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Building local Django docs as HTML on Win32?
I've found a number of places on the net that tell me how to build myself a copy of Django documentation from the Restructured Text format, but they are all for Linux / BSD. Any advice on how to do this on Windows without Cygwin? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---