Re: ModelMultipleChoiceField - different number of values in request _body and _post

2022-01-17 Thread Campbell McKilligan
Here's the parsed POST payload (I've trimmed all the HTML in the payload since it's repetitive). Below is the non-parsed non-trimmed POST payload. 1. csrfmiddlewaretoken: FmbcJ2t1RV6rMSf4TJzzPOe8Zm1yzXx7Jh3mdfSK1TTMEdBCKs5VIWhICBbbPNn6 2. key: acme-seoul-2022-cast 3. expiry_date

Re: ModelMultipleChoiceField - different number of values in request _body and _post

2022-01-16 Thread Patrice Chaula
Information for your post request is missing. Paste all the data that is sent when making a post request. That way everyone gets the idea of what you are trying to achieve. On Sun, Jan 16, 2022, 10:22 PM Campbell McKilligan wrote: > Hi, > I have an ajax request which submits multiple values to a

ModelMultipleChoiceField - different number of values in request _body and _post

2022-01-16 Thread Campbell McKilligan
Hi, I have an ajax request which submits multiple values to an UpdateView. In the request dict body I see both values (in this case, for the pool_list column): '_body': b"csrfmiddlewaretoken=z...h&...&key=...&expiry_datetime=&overflow=555& *pool_list=507&pool_list=499*&... Later in the request

Re: ModelMultipleChoiceField - override validation

2021-11-22 Thread Earl Lapus
> I have a ModelForm that has a ModelMultipleChoiceField. In the said field, > I've set the queryset to none and assigned the FilteredSelectMultiple as > the widget for the field. > > It looks like this: > > class MyForm(forms.ModelForm): > myfield = Mode

ModelMultipleChoiceField - override validation

2021-11-19 Thread Earl Lapus
Hi, I have a ModelForm that has a ModelMultipleChoiceField. In the said field, I've set the queryset to none and assigned the FilteredSelectMultiple as the widget for the field. It looks like this: class MyForm(forms.ModelForm): myfield = ModelMultipleChoiceField( que

RE: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-14 Thread Matthew Pava
= Imodelclass.objects.all(), empty_label='' ) = ModelMultipleChoiceField(queryset= Imodelclass.objects.all(), empty_label=None, empty_label='') When you read the error, you see that is actually very clear in this context: You passed two arguments for the same keyword.

Re: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-14 Thread 'Odile Lambert' via Django users
Hello If this is by design Django should raise an error indicating that ModelMultipleChoiceField does not allow an empty_label attribute The present error message in the __init__ of the super_class is not coherent and very difficult to understand for beginners

RE: Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-13 Thread Matthew Pava
however you want it. From: 'Odile Lambert' via Django users [mailto:django-users@googlegroups.com] Sent: Wednesday, March 13, 2019 1:57 PM To: Django users Subject: Bug in Django 2.1 on ModelMultipleChoiceField Hello, I believe Bugs in Django are to be reported in this user list.

Bug in Django 2.1 on ModelMultipleChoiceField

2019-03-13 Thread 'Odile Lambert' via Django users
Hello, I believe Bugs in Django are to be reported in this user list. Below is a report for a bug which does not seem to be already filed. In the documentation reference on the ModelMultipleChoiceField there is no restrictios mentioned on the empty_label

Re: ModelMultipleChoiceField doesn't display objects

2018-12-12 Thread valentin jungbluth
I don't use my form to ModelAdmin part, so to my mind it shouldn't solve my issue ? Le mercredi 12 décembre 2018 15:55:30 UTC+1, valentin jungbluth a écrit : > > Hello guys, > > I would like to use *ModelMultipleChoiceField* with > *ModelSelect2MultipleWidget* in or

Re: ModelMultipleChoiceField doesn't display objects

2018-12-12 Thread Nelson Varela
Check: https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal Maybe this helps -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it,

ModelMultipleChoiceField doesn't display objects

2018-12-12 Thread valentin jungbluth
Hello guys, I would like to use *ModelMultipleChoiceField* with *ModelSelect2MultipleWidget* in order to display a dropdown list with my widget. If I write this : publication_list = forms.ModelMultipleChoiceField(queryset=Publication. objects.all().order_by('pub_id')) It d

Regarding Forms : "ModelMultipleChoiceField"

2015-12-09 Thread Kishan Mehta
Hi All, I am generating admin interface form. I want to add search functionality and paginate my following "ModelMultipleChoiceField" field of django form. Is is possible to achieve this ? Because it contains around 5000 results. Here is my forms.py *class Schedul

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-09 Thread Collin Anderson
Hi, On the html form, you could probably use javascript to filter out the value in the many to many when you select the primary language. In the django form, you could add extra validation by defining form.clean_further_languages(self) Collin On Sunday, December 7, 2014 12:37:22 AM UTC-5, ino

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-06 Thread inoyon artlover KLANGRAUSCH
Hi Collin, yes exactly. It is as follows: User can select a main coummunication language which is connected as ForeignKey to the main langauges table. Withn the field below the user can select further languages but when I select english as main language, this language shouldn't be available withi

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-06 Thread Collin Anderson
Hi, Are you saying you have a ForeignKey choice field on the same form (above the ManyToMany), and when you change the choice field it should change the available values in the ManyToMany? Collin On Thursday, December 4, 2014 7:20:13 PM UTC-5, inoyon artlover KLANGRAUSCH wrote: > > Very cool!

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-04 Thread inoyon artlover KLANGRAUSCH
Very cool! :) Many thanks, once more! :) Could be off-topic, but there is somethin more tricky: Before a ManyToManyField there is one ForeignKeyField which has few of the same values. So the ForeignKey-value has to be excluded from the ManyToMany choices. For example the ForeignKey selection (

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-04 Thread Larry Martell
On Thu, Dec 4, 2014 at 6:46 PM, inoyon artlover KLANGRAUSCH wrote: > Great, it works with one form but not with an another... > Btw. how is it possible to overwrite the 'this field is required' error > message? You can provide your custom set of default errors to the form field definition, e.g.:

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-04 Thread inoyon artlover KLANGRAUSCH
Great, it works with one form but not with an another... Btw. how is it possible to overwrite the 'this field is required' error message? Many thanks and best regards! :) Am Donnerstag, 4. Dezember 2014 23:01:15 UTC+1 schrieb larry@gmail.com: > > On Thu, Dec 4, 2014 at 4:54 PM, inoyon artlo

Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-04 Thread Larry Martell
On Thu, Dec 4, 2014 at 4:54 PM, inoyon artlover KLANGRAUSCH wrote: > Hi there, I got a following Form-Class: > > > class CustomUserprofileInterestsForm(forms.ModelForm): > > interests = forms.ModelMultipleChoiceField( > queryset=Interests.objects.all(), > widget=forms.CheckboxS

How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-04 Thread inoyon artlover KLANGRAUSCH
Hi there, I got a following Form-Class: class CustomUserprofileInterestsForm(forms.ModelForm): interests = forms.ModelMultipleChoiceField( queryset=Interests.objects.all(), widget=forms.CheckboxSelectMultiple) I want to limit the choices for example to 6 of all displayed.

Re: ModelMultipleChoiceField forcing required

2014-11-05 Thread Scot Hacker
On Wednesday, November 5, 2014 11:15:47 AM UTC-8, Carl Meyer wrote: > > So because you are manually creating your `instructors` and `students` > fields on the form, the `blank=True` in the model has no effect; you > need to pass `required=False` to your two form fields. > Got it, right you

Re: ModelMultipleChoiceField forcing required

2014-11-05 Thread Carl Meyer
models.ManyToManyField(Instructor,blank=True) > students =models.ManyToManyField(Profile,blank=True) > > | > > > I can update an instance of this model with no instructors or students > from the CLI just fine. The fields are not required. But I'

ModelMultipleChoiceField forcing required

2014-11-05 Thread Scot Hacker
blank=True) I can update an instance of this model with no instructors or students from the CLI just fine. The fields are not required. But I'm using ModelMultipleChoiceField in the admin: # In admin.py class OfferingAdminForm(forms.ModelForm): instructors = forms.ModelMultipleCh

Re: ModelMultipleChoiceField ignore invalid choices?

2013-10-09 Thread David Cox
, Jon Dufresne wrote: > > Hi, > > I am using a ModelForm with a ModelMultipleChoiceField. I would like > for this field to silently ignore invalid choices instead of creating > a form error. Here is my use case: > > * User A opens form select model choice 1, 2, and 3

ModelMultipleChoiceField ignore invalid choices?

2013-10-07 Thread Jon Dufresne
Hi, I am using a ModelForm with a ModelMultipleChoiceField. I would like for this field to silently ignore invalid choices instead of creating a form error. Here is my use case: * User A opens form select model choice 1, 2, and 3 * User B (different browser) deletes model choice 3 entirely from

possible ModelMultipleChoiceField bug

2013-03-21 Thread Josh Cartmell
Today I noticed that while this breaks things complaining about an unexpected kwarg empty_label: some_field = forms.ModelMultipleChoiceField( widget=forms.CheckboxSelectMultiple(), queryset=SomeM2mField.objects.all(), empty_label='empty') doing the following in a form's init works (as

Re: ModelMultipleChoiceField with MultiWidget ?

2012-08-26 Thread Nicolas Emiliani
Finally, I'm starting to see some light and it is almost working. >From what I see I reckon you will need to create both a custom field and a > custom widget! > > I think so because if you have TextInputs validation may fail on the > ModelMultipleChoiceField? > Yes, they

Re: ModelMultipleChoiceField with MultiWidget ?

2012-08-26 Thread Joseph Mutumi
Disclaimer - I have never done this before! >From what I see I reckon you will need to create both a custom field and a custom widget! I think so because if you have TextInputs validation may fail on the ModelMultipleChoiceField? I would think you need to override the methods: __init__, cl

ModelMultipleChoiceField with MultiWidget ?

2012-08-26 Thread Nicolas Emiliani
Hi, I've been struggling with this for the past two weeks, and i think it's time to ask. I have and admin form that has a ModelMultipleChoiceField that is used to display a ManyToMany model field that specifies a through model class Person(models.Model): name = models.CharField(

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread akaariai
On Apr 23, 6:54 pm, "Daniel Sokolowski" wrote: > +1 > > I use SQlite3 on lower traffic production sites due to it's ease of install > and deployment. Even though I only once I reached this 1000 variable limit I > would like to see some django work around. I thought a little more about this, and I

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread Daniel Sokolowski
jango users Subject: Re: 'too many SQL variables' error with ModelMultipleChoiceField On Apr 23, 10:48 am, Lukas Zilka wrote: Hey Russ, thanks for your reply. I looked at the bulk insertion problem, and that made me think that probably using the variables themselves is the probl

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread akaariai
On Apr 23, 10:48 am, Lukas Zilka wrote: > Hey Russ, > > thanks for your reply. I looked at the bulk insertion problem, and > that made me think that probably using the variables themselves is the > problem. It does not really make sense to me why anybody bothers to > use variables in a long SQL

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread Lukas Zilka
to > select a lot more options, then you might need to use a more exotic widget > that avoids the need to transfer full lists back and forth. > > Yours, > Russ Magee %-) > > > > > > > > On Monday, 23 April 2012 at 5:38 AM, Lukas Zilka wrote: > > Hello, > > >

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread Lukas Zilka
lar problem you have at least these choices: > 1. Use different database. I guess you have a reason to use SQLite so > this might not be an option. > 2. Compile SQLite yourself with a higher parameter limit. If you need to > deploy your software on multiple machines this might be hard t

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread akaariai
On Apr 23, 1:43 pm, Javier Guerra Giraldez wrote: > On Mon, Apr 23, 2012 at 3:58 AM, akaariai wrote: > > The last one, qs.filter(id__in=large_list) is pretty much impossible to fix. > > what's wrong with: > > qs.filter((Q(id__in=large_list[:n])|Q(id__in=large_list[n:])))  ? > > >   1. Use differe

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread Javier Guerra Giraldez
On Mon, Apr 23, 2012 at 3:58 AM, akaariai wrote: > The last one, qs.filter(id__in=large_list) is pretty much impossible to fix. what's wrong with: qs.filter((Q(id__in=large_list[:n])|Q(id__in=large_list[n:]))) ? >   1. Use different database. I guess you have a reason to use SQLite so this > m

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-23 Thread akaariai
ple machines this might be hard to do. 3. Work around the issues in your code. Maybe a ModelMultipleChoiceField subclass which does the .clean() in a safe way would work. Or better yet do as Russell said: try to remove the need to have 1000 options in one field altogether. - Anssi --

Re: 'too many SQL variables' error with ModelMultipleChoiceField

2012-04-22 Thread Russell Keith-Magee
u might need to use a more exotic widget that avoids the need to transfer full lists back and forth. Yours, Russ Magee %-) On Monday, 23 April 2012 at 5:38 AM, Lukas Zilka wrote: > Hello, > > I have a form with ModelMultipleChoiceField on it, and I am getting > 'DatabaseError

'too many SQL variables' error with ModelMultipleChoiceField

2012-04-22 Thread Lukas Zilka
Hello, I have a form with ModelMultipleChoiceField on it, and I am getting 'DatabaseError: too many SQL variables' (using SQLite) when the user picks more than 1000 entries in the selection widget and posts the form. The problem seems to be the method clean of ModelMultipleChoiceFi

ModelMultipleChoiceField in edit form

2012-04-22 Thread dummyman dummyman
Hi, I have a django admin form where in i have overriden two fields widgets to display in ModelMultipleChoiceField ie attributea = forms.ModelMultipleChoiceField() attributeb=forms.ModelMultipleChoiceField() now i when i click save and add another data will be saved to database and will be

Re: Is there a orded ModelMultipleChoiceField ?

2012-02-25 Thread Carlos Leite
,and users can select some instances and they can change the order of > the items. But, the field ModelMultipleChoiceField couldn't take the > order. > > Some key codes are: > > forms.py > class ExcelForm(forms.Form): >    choices = > forms.ModelMultipleChoiceField

Is there a orded ModelMultipleChoiceField ?

2012-02-24 Thread fabby bobby
of the items. But, the field ModelMultipleChoiceField couldn't take the order. Some key codes are: forms.py class ExcelForm(forms.Form): choices = forms.ModelMultipleChoiceField(queryset=Question.objects.all(), required=False, widget=forms.SelectMultiple) views.py if request.m

Re: Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Nan
down, or Django just doesn't support setting the values of a ModelMultipleChoiceField in the clean() method. On May 16, 3:36 pm, Shawn Milochik wrote: > Try putting logging statements at strategic points and see when your > expectations aren't met. -- You received this messag

Re: Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Shawn Milochik
Try putting logging statements at strategic points and see when your expectations aren't met. -- 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, se

Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Nan
For a formwizard, I'm trying to set the values of a ModelMultipleChoiceField in the form's clean() method, based on the cleaned_data from another field, and it's not working. Here's roughly what I'm trying to do: # forms.py from django import forms from myapp.models imp

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
Ah, now there is a new problem. Before, my ManyToManyField was unsorted, but it was possible to add new items by clicking on the "+" button. Now my items are sorted thanks to a ModelMultipleChoiceFormField (with "order_by('...')" and "required=False"), but the "+" button is gone. Is there a way t

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
> No form fields take that argument - that's for model fields. > > Form fields take the argument "required", which defaults to True. Thank you! That is exactly the information I needed. By the way, is there a special reason why "blank" of model fields translates to "required" of form fields? San

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Daniel Roseman
On Tuesday, February 1, 2011 9:45:04 AM UTC, Santiago Caracol wrote: > > Hi, > > why can't a ModelMultipleChoiceField not have the property > "blank=True"? > > I need the ModelMultipleChoiceField to sort the values of a > models.ManyToManyField in a for

blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
Hi, why can't a ModelMultipleChoiceField not have the property "blank=True"? I need the ModelMultipleChoiceField to sort the values of a models.ManyToManyField in a form class. Sorting works as expected, but only if the field is obligatory. (Else, I get the error message "

Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-09-13 Thread The Boss
> I generally do something like: > > class OrderForm(ModelForm): >     def __init__(self, *args, **kw): >         ordernumber = '%06d' % kw.pop('ordernumber', 0) >         super(OrderForm, self).__init__(*args, **kw) >         self.fields['associated_files'].queryset = >             ArchivedFile.ob

Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-27 Thread Karen Tracey
On Thu, Aug 26, 2010 at 11:09 PM, The Boss wrote: > This should really be much easier. I generally do something like: class OrderForm(ModelForm): def __init__(self, *args, **kw): ordernumber = '%06d' % kw.pop('ordernumber', 0) super(OrderForm, self).__init__(*args, **kw)

Re: ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-26 Thread The Boss
Ok, I sort of found a solution. After much digging and looking at class dictionaries I found that i could manually update the dictionary self.base_fields. self.base_fields['associated_files'] =self.__class__.associated_files It's seems that class attrs assigned in init do not get added t

ModelMultipleChoiceField queryset argument does not limit widget choices

2010-08-26 Thread The Boss
__init__(self,*args,**kw): self.ordernumber = '%06d'%kw.pop('ordernumber',0) print 'myquery',self.myquery() self.__class__.associated_files=ModelMultipleChoiceField(queryset=self.myquery(),required=False) ModelForm.__init__(self,*args,**k

Admin ModelMultipleChoiceField does not keep order

2010-05-24 Thread Eric
Hi, I'm using a ModelMutlipleChoiceField for a comma separated field and the list of selected object does not respect order of the html field. After several hours of tracing, understanding how it all work, I discovered that the raw data of the field(widget) has the right order but that converting

Re: modelmultiplechoicefield show as null on the template -2

2010-04-16 Thread Tom Evans
On Fri, Apr 16, 2010 at 6:52 PM, Daxal wrote: > Hi, > > None of my other views have RequestContext in them and they are > passing in the same variables. I am one of those programmers that come > in succession trying to figure out what the previous one was trying to > do. and this guy didn't even p

Re: modelmultiplechoicefield show as null on the template -2

2010-04-16 Thread Daxal
Hi, None of my other views have RequestContext in them and they are passing in the same variables. I am one of those programmers that come in succession trying to figure out what the previous one was trying to do. and this guy didn't even put any comments on it. so it takes me a longg time to try

Re: modelmultiplechoicefield show as null on the template -2

2010-04-16 Thread Tom Evans
On Fri, Apr 16, 2010 at 4:16 PM, Daxal wrote: > Hi, > > I changed it to this. and i am pretty sure this is correct > def cvdetails(request, id): >  if request.method == 'POST': >    f = cvForm(request.POST) >    if form.is_valid(): >      return HttpResponseRedirect('cm/cvdetails.html') >  else: >

Re: modelmultiplechoicefield show as null on the template -2

2010-04-16 Thread Daxal
for every single page. so my cvdetails.html extends application.html but it gives me this error when it does not for any other page. any ideas on what maybe causing this? thanks On Apr 16, 11:01 am, Daniel Roseman wrote: > On Apr 16, 3:22 pm, Daxal wrote: > > > > > Hey guys, &

Re: modelmultiplechoicefield show as null on the template -2

2010-04-16 Thread Daniel Roseman
On Apr 16, 3:22 pm, Daxal wrote: > Hey guys, > > I am trying to render a modelmultiplechoicefield on my template and i > cannot seem to figure out how. any help would be appreciated. > > Thanks. > > Here is model: > class cvdb(models.Model): >   user = models

modelmultiplechoicefield show as null on the template -2

2010-04-16 Thread Daxal
Hey guys, I am trying to render a modelmultiplechoicefield on my template and i cannot seem to figure out how. any help would be appreciated. Thanks. Here is model: class cvdb(models.Model): user = models.ForeignKey(User) Language = models.ManyToManyField(Language, db_table

modelmultiplechoicefield show as null on the template

2010-04-15 Thread Daxal
Hey guys, I am trying to render a modelmultiplechoicefield on my template and i cannot seem to figure out how. any help would be appreciated. Thanks. Here is model: class cvdb(models.Model): user = models.ForeignKey(User) Language = models.ManyToManyField(Language, db_table

Re: creating basic view for a modelmultiplechoicefield

2010-04-09 Thread Daxal
Hi Daniel, Thank you very much for your reply. That cleared quite a lot of stuff for me. I was wondering if you have any links on how to populate models through the admin interface. I would like to have it editable from admin (makes it much easier to handle). If you have any links or ideas on how

Re: creating basic view for a modelmultiplechoicefield

2010-04-09 Thread Daniel Roseman
On Apr 9, 9:42 am, Daxal wrote: > Basically, I am starting to create a view called "cvdetails" and it is > linked to "cvdetails.html" link for template. > > The form is supposed to use is: > > class cvForm(forms.Form): >   Language = > forms.ModelMultipleChoiceField(queryset=C.Language.objects.all

creating basic view for a modelmultiplechoicefield

2010-04-09 Thread Daxal
Basically, I am starting to create a view called "cvdetails" and it is linked to "cvdetails.html" link for template. The form is supposed to use is: class cvForm(forms.Form): Language = forms.ModelMultipleChoiceField(queryset=C.Language.objects.all()) ProfDesgn = forms.ModelMultipleChoiceFiel

ModelMultipleChoiceField and plus sign

2010-04-07 Thread Asim Yuksel
I have a field called peopleid. The default admin page displays this as a dropdown list and shows a green plus sign near it. Instead of dropdown, I want to use MultipleChoiceField. But if I define this field. I dont see the plus sign? How can I make it appear near the ModelMultipleChoiceField

Re: initial selected values in modelmultiplechoicefield

2010-04-01 Thread Sander
er wrote: > Hi guys, > > This might be a very simple question but it's really driving me crazy > for not working. > > I'm trying to set the initial selected values of a > ModelMultipleChoiceField like this: > > class MyForm(forms.Form): >  

initial selected values in modelmultiplechoicefield

2010-04-01 Thread Sander
Hi guys, This might be a very simple question but it's really driving me crazy for not working. I'm trying to set the initial selected values of a ModelMultipleChoiceField like this: class MyForm(forms.Form): arrondissement = forms.ModelMultipleChoiceFiel

Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-29 Thread Wilberoni
Thanks Shawn. Funny that you posted the anwer at exactly the same time it occurred to me. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send em

Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-28 Thread Wilberoni
No matter how hard I look, I always find the answer after I post the question: [v.id for v in new_volunteers] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe fro

Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-27 Thread Wilberoni
I can build up the list manually ids=[] for v in new_volunteers: ids.add(v.id) I'm just wondering if there's a more elegant way to do it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@

Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-27 Thread Shawn Milochik
On Mar 28, 2010, at 1:16 AM, Wilberoni wrote: > > ModelMultipleChoiceField in a form takes a queryset to load the > selectable items. > > volunteers = > forms.ModelMultipleChoiceField( queryset=VolunteerProfile.objects.all ) > > In save(), I call cleaned_data to

Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-27 Thread Wilberoni
ModelMultipleChoiceField in a form takes a queryset to load the selectable items. volunteers = forms.ModelMultipleChoiceField( queryset=VolunteerProfile.objects.all ) In save(), I call cleaned_data to get the items that were selected: new_volunteers = self.cleaned_data.get

Re: ModelMultipleChoiceField for a ManyToManyField relation to attach Images to a blogpost by using BlogForm

2010-01-05 Thread Daniel Roseman
On Jan 5, 3:27 am, GoSantoni wrote: > Hey Daniel, > > Thanks for response, as always helpful and quick. Like you suggested I > changed the fields to the class. This resulted in a error because > BlogForm could not be found. So I decided not to bother the photologue > model but import the Images in

Re: ModelMultipleChoiceField for a ManyToManyField relation to attach Images to a blogpost by using BlogForm

2010-01-04 Thread GoSantoni
Hey Daniel, Thanks for response, as always helpful and quick. Like you suggested I changed the fields to the class. This resulted in a error because BlogForm could not be found. So I decided not to bother the photologue model but import the Images into the blog model. This resulted in: * blog

Re: ModelMultipleChoiceField for a ManyToManyField relation to attach Images to a blogpost by using BlogForm

2010-01-03 Thread Daniel Roseman
On Jan 3, 7:54 pm, GoSantoni wrote: > Hi group, > > I've been using the django project docs about the ModelForm but still > I've got problems using the ModelMultipleChoiceField for a > ManyToManyField relation. The aim is to relate Images to blog Posts. > So images

ModelMultipleChoiceField for a ManyToManyField relation to attach Images to a blogpost by using BlogForm

2010-01-03 Thread GoSantoni
Hi group, I've been using the django project docs about the ModelForm but still I've got problems using the ModelMultipleChoiceField for a ManyToManyField relation. The aim is to relate Images to blog Posts. So images can get attached to multiple posts and posts can be attached to multi

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-12-01 Thread Gloria
After much digging, I discovered that I cannot iterate over a forms.ModelMultipleChoiceField. This explains the template iteration issue. It seems like I need a FormSet to be able to set these values, and iterate over them. This is overly complicated, just for a set of checkboxes, but it looks lik

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-30 Thread Gloria
> > Hmmm... what are you trying to do by passing the queryset?  Doesn't that > send your form everybody's data, instead of just the active user? No, it doesn't. It returns all available options that users can optionally select. Users selections of these fields are stored elsewhere. > If I > rec

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread Nick Arnett
On Sun, Nov 29, 2009 at 8:30 PM, Gloria wrote: > Here's the line from my model: > class UserProfile(models.Model): >some other fields... >privacy_options = models.ManyToManyField(PrivacyOption, > blank=True, null=True, db_table = 'usr_privacy_selection') > > Here's the bit from my form: >

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread Gloria
Here's the line from my model: class UserProfile(models.Model): some other fields... privacy_options = models.ManyToManyField(PrivacyOption, blank=True, null=True, db_table = 'usr_privacy_selection') Here's the bit from my form: class ModifyProfileForm(forms.Form): some other fields..

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread levin11
Hi, I tried to post this two hours ago, but it did not show up. So sorry if this is the second copy. I use "checkboxed" ModelMultipleChoiceField w/o any problems. Here is a snippet: class PictureForm(ModelForm): tags = ModelMultipleChoiceField(queryset=Tag.objects.all

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread levin11
I have ModelMultipleChoiceField working for me OK, but I am not sure I understand your question. Could you be a bit more specific? This is a snippet from my code which may or may not help: class PictureForm(ModelForm): tags = ModelMultipleChoiceField(queryset=Tag.objects.all(), widget

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread Nick Arnett
t; value > for certain checkboxes, based on some user data I received in that > view. > How do I generate "checked" HTML option using the builtin > ModelMultipleChoiceField for certain checkboxes? Is there a builtin > option that I should set manually to cause the "checke

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread Gloria
that view. How do I generate "checked" HTML option using the builtin ModelMultipleChoiceField for certain checkboxes? Is there a builtin option that I should set manually to cause the "checked" option to be generated? Or do I have to iterate over these fields, match them with data

Re: ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-29 Thread Nick Arnett
On Sat, Nov 28, 2009 at 3:05 PM, Gloria wrote: > Hi all, > I've spent way too much time getting trying to get this widget to work > the way I am envisioning. > In the forms, I want to initialize it, but in the view I need to > determine which boxes are checked. > Has anyone done this without writ

ModelMultipleChoiceField with checkboxes: How to generate the HTML "checked" option?

2009-11-28 Thread Gloria
Hi all, I've spent way too much time getting trying to get this widget to work the way I am envisioning. In the forms, I want to initialize it, but in the view I need to determine which boxes are checked. Has anyone done this without writing their own widget? It would be great to know how. Thank yo

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-23 Thread Benjamin Wolf
On Nov 20, 3:52 am, leoz01 wrote: >>> >>>> I think the easiest way is to make your own widget or otherwise you >>>> can make your own form field. >>>> >>>> On 19 nov, 10:19, Benjamin Wolf wrote: >>>> &g

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-23 Thread Tim Valenta
; > > > On 19 nov, 10:19, Benjamin Wolf wrote: > > > > > Hello, > > > > > I'm using Django's form and ModelMultipleChoiceField. > > > > ModelMultipleChoiceField produces a select list with multiple options. > > > > Is it possible to use > > &

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-23 Thread Tim Valenta
make your own form field. > > > On 19 nov, 10:19, Benjamin Wolf wrote: > > > > Hello, > > > > I'm using Django's form and ModelMultipleChoiceField. > > > ModelMultipleChoiceField produces a select list with multiple options. > > > Is it possible t

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-23 Thread aa56280
9 nov, 10:19, Benjamin Wolf wrote: > > > Hello, > > > I'm using Django's form and ModelMultipleChoiceField. > > ModelMultipleChoiceField produces a select list with multiple options. > > Is it possible to use > >checkboxesinstead? > > > Th

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-23 Thread Matt Schinckel
On Nov 20, 7:52 pm, leoz01 wrote: > I think the easiest way is to make your own widget or otherwise you > can make your own form field. > > On 19 nov, 10:19, Benjamin Wolf wrote: > > > > > Hello, > > > I'm using Django's form and ModelMultipleChoice

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-22 Thread leoz01
I think the easiest way is to make your own widget or otherwise you can make your own form field. On 19 nov, 10:19, Benjamin Wolf wrote: > Hello, > > I'm using Django's form and ModelMultipleChoiceField. > ModelMultipleChoiceField produces a select list with multiple opt

Re: Forms ModelMultipleChoiceField with checkboxes?

2009-11-21 Thread aa56280
ngo's form and ModelMultipleChoiceField. > ModelMultipleChoiceField produces a select list with multiple options. > Is it possible to use > checkboxes instead? > > Thanks, > Greets Ben -- You received this message because you are subscribed to the Google Groups "Django

Forms ModelMultipleChoiceField with checkboxes?

2009-11-19 Thread Benjamin Wolf
Hello, I'm using Django's form and ModelMultipleChoiceField. ModelMultipleChoiceField produces a select list with multiple options. Is it possible to use checkboxes instead? Thanks, Greets Ben -- You received this message because you are subscribed to the Google Groups "Djan

Re: ModelMultipleChoiceField - when is queryset updated?

2009-06-29 Thread adrian
Also this behavior is different from ModelChoiceField - which DOES seem to update immediately if an instance is added to the model. I'm using version 1.0.2 Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

ModelMultipleChoiceField - when is queryset updated?

2009-06-29 Thread adrian
I had this: disciplines = forms.ModelMultipleChoiceField(queryset = Discipline.objects.all()) But if new Disciplines are created during runtime they do not appear on the list when a new form is rendered. There doesn't seem to be a mention of that fact in the documentation. So is it correct t

Re: ModelMultipleChoiceField

2009-03-02 Thread natxooy
Thanks!! that works On 2 mar, 19:26, Alex Gaynor wrote: > On Mon, Mar 2, 2009 at 12:42 PM, wrote: > > > I've got an error using ModelMultipleChoiceField, but don't guess > > where: > > > my form is : > > > class SearchForm(forms.Form): &

Re: ModelMultipleChoiceField

2009-03-02 Thread Alex Gaynor
On Mon, Mar 2, 2009 at 12:42 PM, wrote: > > I've got an error using ModelMultipleChoiceField, but don't guess > where: > > my form is : > > class SearchForm(forms.Form): >titulos = forms.ModelMultipleChoiceField(Titulo.objects.all > ().order_by('tip

ModelMultipleChoiceField

2009-03-02 Thread natxooy
I've got an error using ModelMultipleChoiceField, but don't guess where: my form is : class SearchForm(forms.Form): titulos = forms.ModelMultipleChoiceField(Titulo.objects.all ().order_by('tipo'), label='Títulos') in my template I insert i

  1   2   >