Re: Queryset in newforms

2007-09-28 Thread Collin Grady
Mario Gonzalez said the following: > That's what I want to solve, give the opportunity to the programmer > to change the queryset easily when a form_for_model is needed but you > don't need the default queryset. I understand what you want, and you can do it with a formfield_callback! You do /n

Re: Queryset in newforms

2007-09-28 Thread Mario Gonzalez
On 27 sep, 18:36, Collin Grady <[EMAIL PROTECTED]> wrote: > > Actually, you don't - I just checked the formfield method of > ManyToManyField, and you can pass the queryset directly to that, so it > will use that when it generates the field instead of whatever it would > normally default to. > Ye

Re: Queryset in newforms

2007-09-27 Thread Collin Grady
Mario Gonzalez said the following: > I haven't seen this before, I'll try it but IMVHO it seems a hack > because you've got to generate a field and _then_ change the queryset. > I think the queryset must be defined once and not after. Actually, you don't - I just checked the formfield method of

Re: Queryset in newforms

2007-09-27 Thread Collin Grady
Mario Gonzalez said the following: > I should have to write the all callback and I think that's not what > I want. My proposal is if you've got a special queryset, just pass it > trough form_for_model() method only. Then you haven't got to re-write > all over again. Rewrite what all over? All y

Re: Queryset in newforms

2007-09-27 Thread Mario Gonzalez
On 27 sep, 18:03, Collin Grady <[EMAIL PROTECTED]> wrote: > Mario Gonzalez said the following: > > > I should have to write the all callback and I think that's not what > > I want. My proposal is if you've got a special queryset, just pass it > > trough form_for_model() method only. Then you hav

Re: Queryset in newforms

2007-09-27 Thread Collin Grady
Mario Gonzalez said the following: > In my DB I've got lot of users, each one with different groups and > permissions, and I don't want to show them in my form. So, I want to > pass a parameter in form_for_model() and I wrote a patch for that: Just make your own formfield_callback, that's what it

Re: Queryset in newforms

2007-09-27 Thread Mario Gonzalez
On 27 sep, 16:25, Collin Grady <[EMAIL PROTECTED]> wrote: > Mario Gonzalez said the following: > > > In my DB I've got lot of users, each one with different groups and > > permissions, and I don't want to show them in my form. So, I want to > > pass a parameter in form_for_model() and I wrote a pa

Queryset in newforms

2007-09-27 Thread Mario Gonzalez
Hello: I usually show forms using form_for_model(), however there's something I think is missing. My model is something like: class TransferFile(models.Model): file = models.FileField(upload_to="/some/path/in/my/system/") owner = models.ForeignKey(User, db_column="owner", db_ind