Re: show_all_rows = False returns db error message

2006-09-25 Thread Chris Long
Try updating to the latest revision, there was a bug I fixed a few days ago that was causing this error for a lot of people. If it still doesn't work, please pastebin your model, and let us know the database system you are using and the steps taken. Chris

Re: Django Cheat Sheet - Lost?

2006-09-23 Thread Chris Long
Search on google gave: http://www.woodpecker.org.cn:9081/classes/050925-CPUG/django_reference_sheet.pdf#search=%22django%20reference%20sheet%22 http://code.djangoproject.com/wiki/DjangoCheatSheet Chris --~--~-~--~~~---~--~~ You received this message because you

Re: Advanced Admin Customization

2006-09-06 Thread Chris Long
Either that, or use a custom manipulator and override the save method there. Depends on if the processing will always need to be done when saving or just done with the form data. If it's the form data, probably best to put it in a manipulator. If you want, just create a manipulator and override

Re: django/core/meta

2006-09-01 Thread Chris Long
See: http://www.djangoproject.com/documentation/model_api/#unique-together Cheers, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Advanced Admin Customization

2006-08-31 Thread Chris Long
> Oh, I see where you're going with it. Just hide the interface from the > user. That's a great idea, I still need a way though to enforce it so > that carefully crafted POST requests don't allow unauthorized users > from breaking things. That's true, maybe using the custom manipulator would

Re: Advanced Admin Customization

2006-08-31 Thread Chris Long
> Thanks, that's a neat trick, though from the surface I'm not 100% sure > it will do what I'm thinking. I'll have to investigate further. My > intuition tells me I need to do the checks in the model, maybe with a > save hook, not in the template; but I may be off on that. Maybe, but if you do

Re: Advanced Admin Customization

2006-08-31 Thread Chris Long
Howdy, For the permission checking, you could override the admin template and add auth checking in there for the various permissions you want to check for. See: http://code.djangoproject.com/wiki/ExtendingAdminTemplates for more details on this. And in the auth documents there is info on how to

Re: AJAXWidgetComboBox in admin?

2006-08-29 Thread Chris Long
Nothing right now. Currently the admin interface doesn't use any AJAX, but it has been under discussion for a while to implement it. If you did wish to use it, you could probably modify the admin interface fairly easily to implement it (w/o changing the actual django.contrib.admin) package.

Re: iteration of object_list in generic detail view

2006-08-28 Thread Chris Long
You can do something like this: def extra_object_detail(...): context = {"next":nextObj, "previous":previousObj} return object_detail(..., extra_context=context) The generic view adds the extra_context parameter to the context so you can access it in your template. Chris

Re: Dynamic Menus...

2006-08-24 Thread Chris Long
Using javascript would be the way to go. Though you have two options on how to know which car relates to which manufacturer. 1) AJAX: Query the server, which will return a list to be placed in the select field. 2) Hard coded JS: Hard code it into a JS array that will then be used to look up the

Re: Problem getting list from SelectMultipleField

2006-08-24 Thread Chris Long
Try: data.getlist('teams') Chris --~--~-~--~~~---~--~~ 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

Re: How to check if a request was a POST or GET

2006-08-24 Thread Chris Long
Might be of help: http://www.djangoproject.com/documentation/request_response/#httprequest-objects if request.method == 'GET': do_something() elif request.method == 'POST': do_something_else() Chris --~--~-~--~~~---~--~~ You received this message

Re: returning related field as part of __str__() method?

2006-08-22 Thread Chris Long
Try either: def __str__(self): return '%s - %s' % (self.name, str(self.category)) or def __str__(self): return '%s - %s' % (self.name, self.category.name) The problem is that it is using __repr__ to print it out, not str. To force str you have to use the str(). Or you

Re: Paging admin pages

2006-08-22 Thread Chris Long
This might be of use: http://www.djangoproject.com/documentation/model_api/#list-per-page Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: how to assign permissions to users and groups?

2006-08-22 Thread Chris Long
To add permissions. For user: user.user_permissions.add(perm) (I think, don't have the chance to double check) For group: group.permissions.add(perm) For your question, the permission table contains the codename, verbose name and content type of the object. In most cases, you could probably get

Re: how to assign permissions to users and groups?

2006-08-21 Thread Chris Long
If I have a group instance called students and I wanted to add it to the user instance bill I would use: bill.groups.add(students) If you want to have a permission for a view, you will have to use the has_perm method that is within the user model (user.has_perm) and check for the permission you

Re: Efficient ways to limit_choices_to

2006-08-21 Thread Chris Long
Hey Seemant, Sorry about not getting back to you sooner to work on this. Been finishing off last minute details with my SoC project. Here is what I've come up w/ that (w/ my limited testing) seems to work: preacher = models.ForeignKey ( Person, limit_choices_to = {

Re: Override value on save in admin

2006-08-17 Thread Chris Long
Might be of help: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: how to redirect to a new page,but keep the browser's url unchanged

2006-08-16 Thread Chris Long
If you had two views: def view_1(request): return render_to_response(...) def view_2(request): return view_1(request) Will return the view_1 but will be under the view_2 URL. Chris --~--~-~--~~~---~--~~ You received this message because

Re: More complex QuerySets and generic views

2006-08-15 Thread Chris Long
You could simplify your urls.py by extending the generic view with another view, e.g. an example from the authorization document: from django.views.generic.date_based import object_detail @login_required def limited_object_detail(*args, **kwargs): return object_detail(*args, **kwargs) It

Re: How would I do this with Djangol?

2006-08-05 Thread Chris Long
This might help: http://www.djangoproject.com/documentation/db_api/#latest-field-name-none Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Creating User Accounts

2006-08-03 Thread Chris Long
I believe there are articles on blogs and wiki posts about extending the user model. The basic idea as of right now (as far as I know), before model inheritance is committed, is to connect the two using a foreign key. If you want to create a user and relate it to the customer object, best spot

Re: Using form manipulator for data in multiple models

2006-08-02 Thread Chris Long
Not sure if this is of any help Create a manipulator with the form fields, doesn't matter if they are for two different models just make sure to remember the name. If you want to prepopulate the fields, you might have to fill in the data dictionary before creating the formwrapper and passing

Re: Is AJAX Alone Reason to Use TG?`

2006-08-02 Thread Chris Long
It's not very hard to integrate AJAX into Django, it is a bit more manual then TG (from what I've read). But with the AJAX frameworks out there, writing the javascript is far from hard. James has a blog article on AJAX and Django: