fields (1 Choicefield and 2 ModelChoicefields):
> The Choicefield displays names of objects by id's. However, in my db, I
> have multiple objects with the same name. I am trying to filter these
> objects by "species" and "gender" (the two ModelChoiceFields).
Hello,
I have a form with three fields (1 Choicefield and 2 ModelChoicefields):
The Choicefield displays names of objects by id's. However, in my db, I
have multiple objects with the same name. I am trying to filter these
objects by "species" and "gender" (the t
I am trying to have a ChoiceField in a form, but it gives me this error:
from TachlisGeredt.register_form import register
File "/Users/kovyjacob/TachlisGeredt/TachlisGeredt/register_form.py",
line 10, in
class RegisterForm (forms.Form):
File "/Users/kovyjaco
I want to exclude those options from the ChoiceField in the forms that has
been already selected and are into the database. Below is the Code.
models.py
SEMESTER_CHOICES = (
("1", "1"),
("2", "2"),
("3", "3"),
("
I want to exclude those options from the ChoiceField in the forms that has
been already selected and are into the database. Below is the Code.
models.py
```
SEMESTER_CHOICES = (
("1", "1"),
("2", "2"),
("3", "3"),
can you please show me the implementation with respect to my code ?
On Tuesday, December 24, 2019 at 7:03:23 PM UTC+5:30, Nitin Kalmaste wrote:
>
> You can do request.get[field name]
> And make your conditions in views
>
> On Tue 24 Dec, 2019, 6:50 PM shree hari, > wrote:
>
>> # views.py
>> def p
Thank you.
Will give it a try.
On Tuesday, December 24, 2019 at 7:03:23 PM UTC+5:30, Nitin Kalmaste wrote:
>
> You can do request.get[field name]
> And make your conditions in views
>
> On Tue 24 Dec, 2019, 6:50 PM shree hari, > wrote:
>
>> # views.py
>> def price_choices(request):
>> if requ
Thank you.
Will give it a try.
On Tuesday, December 24, 2019 at 7:03:23 PM UTC+5:30, Nitin Kalmaste wrote:
>
> You can do request.get[field name]
> And make your conditions in views
>
> On Tue 24 Dec, 2019, 6:50 PM shree hari, > wrote:
>
>> # views.py
>> def price_choices(request):
>> if requ
You can do request.get[field name]
And make your conditions in views
On Tue 24 Dec, 2019, 6:50 PM shree hari, wrote:
> # views.py
> def price_choices(request):
> if request.method == "GET":
> context = {}
> context['form'] = pricechoice()
> return render( request, "te
# views.py
def price_choices(request):
if request.method == "GET":
context = {}
context['form'] = pricechoice()
return render( request, "template_form.html", context)
# forms.py
price_CHOICES =(
("1", "25"),
("2", "50"),
("3", "100"),
("4", "200"),
Initially posted on stack overflow:
https://stackoverflow.com/questions/59395761/passing-dynamic-choices-into-a-formset-unique-for-each-form
I am working on what I thought was a simple college football confidence
pool. The concept is as follows:
- Bowl Model: Model that stores information of
Bonsoir Niche,
Tu devrais être en mesure d'y arriver en t'assurant que le formulaire
(Form) comprenant
ce champ ait ta valeur ta valeur par défaut comme initial data.
exemple
class MyForm(forms.Form):
field = ChoiceField(widget=widgets.RadioSelect, choices=['un',
Bonjour! comment faire pour avoir un radiobox (ChoiceField) coché avec une
valeur par defaut ?
--
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, send an email
to dj
I want to change option HTML attributes per option.
example:
```
1. a
2. b
```
I think that it is needed to pass extra-data from ChoiceField to
ChoiceWidget Select.
How can I do this?
--
You received this message because you are subscribed to the Google Groups
"Django users&q
On Tue, Jan 19, 2016 at 4:45 PM, steve byerly wrote:
> Also of note, I recently upgraded to Django 1.9 from Django 1.7 where this
> was working fine. It looks like this commit is the cause of my problem:
>
> https://github.com/django/django/commit/ff077cd6496b6f82195e2dc040f70e19e7c206c9
>
>
Is t
It actually looks like the commit fixed the regression and was in 1.9.1.
Didn't realize it had been released.
On Tuesday, January 19, 2016 at 4:45:52 PM UTC-8, steve byerly wrote:
>
> Also of note, I recently upgraded to Django 1.9 from Django 1.7 where this
> was working fine. It looks like thi
Also of note, I recently upgraded to Django 1.9 from Django 1.7 where this
was working fine. It looks like this commit is the cause of my problem:
https://github.com/django/django/commit/ff077cd6496b6f82195e2dc040f70e19e7c206c9
On Tuesday, January 19, 2016 at 4:23:00 PM UTC-8, steve byerly wrote:
I have a model with a nullable field (PositiveSmallIntegerField) with
defined choices. When I make a ModelForm for the model and do not select a
value for this field, the field always comes back in the changed data. The
reason is that the empty choice value, the data_value, is an empty string,
To tell you the truth I'm not quite sure what are you trying to accomplish,
but for starters if you have a select multiple widget then your form field
should be a forms.MultipleChoiceField
On Mon, Jul 13, 2015 at 4:38 PM, dk wrote:
> I made a quick project with an app, that might be easier to s
i might simplify lol i didnt even understand.
after i validate and clean a ChoiceField how do i us it?
does it return a directory saying whats selected?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this grou
i made a from
lista = (("1","one"), ("2", "two"))
pending = forms.ChoiceField(widget=forms.SelectMultiple, choices=lista)
I do get it as post method.
I do get true with is_valid()
it renders properly in the website.
but when I press the submit button.
and I am printing the form.cleaned_data[
#x27;].initial = str(selected_image)
self.fields['*flavors*'].initial = str(selected_flavor)
?
On Fri, Jan 23, 2015 at 8:27 PM, Eugene Goldberg <
eugene.goldberg...@gmail.com> wrote:
> Hello,
> In my Form I have a couple of ChoiceField fields, for which I need to set
&g
Hello,
In my Form I have a couple of ChoiceField fields, for which I need to set a
default / initial value.
I'm trying to do this in the __init__, and my debug shows, that these
values do take, but, when the actual html forms shows up, my default values
are not set as desired.
Am I mi
Hi Daniel,
It worked.
Thanks a lot :)
On Tuesday, August 5, 2014 7:08:34 PM UTC+5:30, Daniel Roseman wrote:
>
> On Tuesday, 5 August 2014 13:28:28 UTC+1, VIPUL BANSAL wrote:
>>
>> Hi,
>>
>> I trying to create a drop-down which gets repopulated every time we land
>> on the page.
>>
>> If I use th
On Tuesday, 5 August 2014 13:28:28 UTC+1, VIPUL BANSAL wrote:
>
> Hi,
>
> I trying to create a drop-down which gets repopulated every time we land
> on the page.
>
> If I use the following code everything works correctly:
>
> class DeleteMappingForm(forms.Form) :
> subAreaDropDown = forms.Choi
Hi,
I trying to create a drop-down which gets repopulated every time we land on
the page.
If I use the following code everything works correctly:
class DeleteMappingForm(forms.Form) :
subAreaDropDown = forms.ChoiceField(choices = fetchChoices())
def deleteMapping(request):
form = D
Hi,
I am new to Django. I am trying to working out on the different fields in
this. From that only I found there are model fields and form fields existed
in it. Now I am working on radio buttons.
For this what I have done is,created a model with field
"title = models.CharField(max_length=3, ch
Hi guys, I'm new here on the list.
I have a question.
yesterday I needed create a form with some fields and one the field was
using select with choicefield.
I needed edit in label default of select.
was as follows:
I wanted like this:
Your state
I done like this:
get the
select rendered are dinamically updated
> through ajax functions.
> The problem is that while saving, the selected options is recognized as
> not valid cause is not in the initial choices:
>
> Select a valid choice. is not one of the available choices.
>
> Any idea on how to solv
the options of those html select rendered are dinamically updated
through ajax functions.
The problem is that while saving, the selected options is recognized as not
valid cause is not in the initial choices:
Select a valid choice. is not one of the available choices.
Any idea on how to solve it?
On Mon, Mar 25, 2013 at 4:54 PM, Dilip M wrote:
> Hi,
>
> I am trying to fill in *choices *for MultipleChoiceField in runtime. I
> am using formWizard and trying to return the dictionary using get_form_kwargs.
>
>
> I am able set the *initial* for CharField but not *choices *for
> MultipleChoic
Hi,
I am trying to fill in *choices *for MultipleChoiceField in runtime. I am
using formWizard and trying to return the dictionary using get_form_kwargs.
I am able set the *initial* for CharField but not *choices *for
MultipleChoiceField.
I am trying to show up dynamic choices based on the user'
Ok, ignore this email - I've just realised one is a Form field, and
the other is a Model field. Apols for stupid.
Cheers
L.
On Fri, Aug 31, 2012 at 1:09 PM, Lachlan Musicman wrote:
> Hi,
>
> I was just wondering if there was any noticeable difference between
> the models.ChoiceField() and the mo
Hi,
I was just wondering if there was any noticeable difference between
the models.ChoiceField() and the models.CharField(max_length=x,)?
In the documentation I have (offline, Django v1.4) a reference to:
/path/django-docs-1.4-en/ref/forms/fields.html#django.forms.ChoiceField.choices
But in the
On 8-8-2012 15:32, BiG-Up wrote:
> I'm working on a formset with dynamic forms. I've overloaded my form
> to be able to add new values in the select field but i cannot
> overload the formset constructor. Django raise exception :
> "__init__() takes exactly 1 argument (2 given)"
formset.add_fields
Hi,
I'm working on a formset with dynamic forms. I've overloaded my form to be able
to add new values in the select field but i cannot overload the formset
constructor. Django raise exception : "__init__() takes exactly 1 argument (2
given)" - How can i change the way the formset_factory build
some more :)
>
> On Fri, May 18, 2012 at 2:57 AM, HDayi wrote:
>> hi curtis,
>> sorry for being so late.
>>
>> on the page i have given the url, it's told exactly how you said. I have
>> subclassed djangos choicefield and just changed validatio
and I'll try to help
some more :)
On Fri, May 18, 2012 at 2:57 AM, HDayi wrote:
> hi curtis,
> sorry for being so late.
>
> on the page i have given the url, it's told exactly how you said. I have
> subclassed djangos choicefield and just changed validation method that
> al
hi curtis,
sorry for being so late.
on the page i have given the url, it's told exactly how you said. I have
subclassed djangos choicefield and just changed validation method that
always return true. so my own clean_fieldname method started to work fine.
I am checking the returned va
Hey,
It would help a lot to see your code posted to dpaste.com or somewhere. As
far as grabbing the choices in your clean method, here's a little
copy-and-paste from Django's own ChoiceField so you can see how they do it:
class ChoiceField(Field):
>
>
hi again,
finally i have solved the problem. I have found a web page saying you must
create a custom choiceField class with a custom validation method. so i did
that.
http://blog.ikraftsoft.com/post/1342312823/django-form-choicefield-dynamic-values
thx
--
You received this message because
hi Kurtis and Frances
after populating the ChoiceField it looks like this
First
Second
at first values were number but django form returns the value for this
ChoiceField after validation.
I don't have a clean_teacher method because i don't know what to do.
i
s school list from database. the other is only a
>> ChoiceField and it's empty. when school is chosen i populate the
>> ChoiceField using dajax. it works perfectly but...
>>
>> while validating the form when calculating the cleaned_data value
>> returns index of the se
have a form which has several selcet boxes. one is a
> ModelChoiceField gets school list from database. the other is only a
> ChoiceField and it's empty. when school is chosen i populate the
> ChoiceField using dajax. it works perfectly but...
>
> while validating the form w
hi people,
i am new to all of this.
i have a form which has several selcet boxes. one is a
ModelChoiceField gets school list from database. the other is only a
ChoiceField and it's empty. when school is chosen i populate the
ChoiceField using dajax. it works perfectly but...
while valid
On Saturday, 28 January 2012 21:41:13 UTC, Squant wrote:
>
> Hello,
> I've created a simple ChoiceField for my app with two items. I need to
> somehow query which choice was made from the user so I can pass the
> appropriate context to my template. What would be an exampl
Hello,
I've created a simple ChoiceField for my app with two items. I need to
somehow query which choice was made from the user so I can pass the
appropriate context to my template. What would be an example of how I
can do such a thing? Thanks!
--
You received this message because yo
hs later)
>>
>> >name 'scac_choicelist' is not defined at the marked
>> >line in my form:
>> >
>> Which is true -- it is not defined at that point. (NOTE: your
>> names
>> don't really help understanding the purpose of the vari
ving target for the few
>> books that did come out to be relevant four months later)
>>
>> >name 'scac_choicelist' is not defined at the marked
>> >line in my form:
>> >
>> Which is true -- it is not defined at that point. (NOTE: y
ned at the marked
> >line in my form:
> >
> Which is true -- it is not defined at that point. (NOTE: your names
> don't really help understanding the purpose of the variables )
>
> >from django import forms
> >from django.forms.fields import ChoiceFi
ur names
> don't really help understanding the purpose of the variables )
>
> >from django import forms
> >from django.forms.fields import ChoiceField
> >from myapp.models import *
> >
> >BOL_CODE_QUALIFIERS = (
> > ('OB', 'Ocean Bill of Ladi
ill in the
> "choices=" attribute for a ChoiceField in a form,
> I could only find static sets of tuples for examples.
> I need to use a table from the DB for the tuples.
> I thought I could make up the choice list myself
> from the table, but I'm getting a Name Error:
&g
Hi All,
When I looked in the docs for how to fill in the
"choices=" attribute for a ChoiceField in a form,
I could only find static sets of tuples for examples.
I need to use a table from the DB for the tuples.
I thought I could make up the choice list myself
from the table, but I
On Thu, Dec 15, 2011 at 8:27 PM, J. Marc Edwards
wrote:
> OK...I have the following model and form.
>
> class CmdString(models.Model):
>
> name = models.CharField(max_length=50)
> cmd = models.CharField(max_length=200)
> eda_app = models.OneToOneField(EDA_App, primary_key=True)
OK...I have the following model and form.
*class CmdString(models.Model):
name= models.CharField(max_length=50)
cmd = models.CharField(max_length=200)
eda_app = models.OneToOneField(EDA_App, primary_key=True)
def __unicode__(self):
return self.cmd *
*cl
On 10/11/11 Asif Jamadar said:
> Suppose I have choicefield in my django model which consist of several
> choices. Now in future if I changed the existing choice (option) with some
> other name (choice), then whether the existing records in model with that
> choice(option) will als
Suppose I have choicefield in my django model which consist of several choices.
Now in future if I changed the existing choice (option) with some other name
(choice), then whether the existing records in model with that choice(option)
will also change? Or In admin page I need to set that new
Whoops, sorry -- I didn't realize you weren't using CBVs. :)
On Wed, Nov 2, 2011 at 12:43 PM, Furbee wrote:
> I think your 'answer' is going to exist in POST in either case. Perhaps
> change the construct of your logic to:
>
> if 'evaluation' in request.POST:
> return render_to_respo
I think your 'answer' is going to exist in POST in either case. Perhaps
change the construct of your logic to:
if 'evaluation' in request.POST:
return render_to_response('results.html')
elif 'form-0-answer' in request.POST:
answer = request.POST.get('answer','')
val
Try changing your success_url to this same page.
On Wed, Nov 2, 2011 at 11:00 AM, asif.jama...@rezayat.net <
asif.jama...@rezayat.net> wrote:
> How can i access the form fields in django views.
>
> Suppose i have modelform called
>
>
> class QuestionForm(forms.ModelForm):
>
>
> answer = forms.Ch
How can i access the form fields in django views.
Suppose i have modelform called
class QuestionForm(forms.ModelForm):
answer = forms.ChoiceField(choices=HAY_EVALUATION_CHOICES,
widget=forms.Select(attrs={'onchange': 'this.form.submit();'}))
In views.py
if 'form-0-answer' in reque
On Dec 11, 5:08 am, Sævar Öfjörð wrote:
> I think you should provide your choices in the form field, not when
> creating an instance of the form.
Agreed. To create a dynamic form such as this, the best way would
probably be to use a custom __init__ function. In your view, when you
create your
I think you should provide your choices in the form field, not when
creating an instance of the form.
The form would then be something like this:
class StoreLocationHoursForm(BForm):
sl_list= [('-', 'Choose Location'), (u'Super City', u'901
PHILADELPHIA STREET')]
location = forms.ChoiceFie
Hi, i have a simple form:
class StoreLocationHoursForm(BForm):
location = forms.ChoiceField(required=True)
day = forms.ChoiceField(choices=bagit_constants.dow,required=True)
time_open_hours =
forms.ChoiceField(choices=constants.hours,required=True)
time_open_minutes =
forms.ChoiceFi
wrote:
> In brief, a [Typed]ChoiceField can reject a valid choice of type
> Decimal because it is incorrectly compared using smart_unicode.
> Decimal('0.5')==Decimal('0.50') is true, while '0.5'=='0.50' is false.
>
> Verbosely, conside
In brief, a [Typed]ChoiceField can reject a valid choice of type
Decimal because it is incorrectly compared using smart_unicode.
Decimal('0.5')==Decimal('0.50') is true, while '0.5'=='0.50' is false.
Verbosely, consider a model defined like so :
class
On Sep 29, 2010, at 5:08 PM, aa56280 wrote:
> Can't you specify the value using the initial argument?
> http://docs.djangoproject.com/en/dev/ref/forms/fields/#initial
>
>
I did that originally, but it doesn't show up when the HiddenInput renders.
That's why I stopped changing the widget.
Sh
Can't you specify the value using the initial argument?
http://docs.djangoproject.com/en/dev/ref/forms/fields/#initial
On Sep 29, 3:33 pm, Shawn Milochik wrote:
> Actually, I spoke too soon on this one. My original solution doesn't work
> because the hidden input on the form doesn't have a valu
Actually, I spoke too soon on this one. My original solution doesn't work
because the hidden input on the form doesn't have a value, so the form won't
validate.
I fixed this by just adding display: none to the widget attrs in the __init__
instead of changing the widget to a HiddenInput. Now the
That seems pretty straightforward me. You want to customize the form
based on the user and so you're doing it when the form is initialized.
Makes perfect sense.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
I ran into an interesting forms issue today which I came up with a solution
for. Now I'm wondering if there's a better way.
Situation:
I have a forms.Form with several fields in it, including a ChoiceField. The
values in this ChoiceField are dependent on what the user has acces
How to suppress invalid_choice validation error for choicefield
-"Select a valid choice. That choice
is not one of ..." ?
I am using a client side combo box where user can either select from
the choices or add a new value. For new value Django - ChoiceField
give invalid_choice valida
Oh, that sounds like a great way to handle it. Thank you!
On Aug 17, 10:10 am, Alex Robbins
wrote:
> Maybe the ChoiceField should just be a CharField that just uses the
> Select widget class? That way it won't have choices hardcoded into the
> field validation. Your clean meth
Maybe the ChoiceField should just be a CharField that just uses the
Select widget class? That way it won't have choices hardcoded into the
field validation. Your clean method could check that the domain is
valid.
Alex
On Aug 16, 1:39 pm, ringemup wrote:
> I have a domain search form
I have a domain search form with two fields: a Textarea for inputting
a list of domains to check, and a ChoiceField for selecting a domain
based on suggestions.
The ChoiceField is required, and on the first submission is auto-
populated with suggestions based on the domains listed in the
textarea
On 7/26/10 4:08 AM, Daniel Roseman wrote:
On Jul 26, 8:49 am, gondor wrote:
I am using admin panel and using get_form to retrieve one of my table
objects. I have a choicefield in this object but I don't know how to
set the default. I have saw numerous examples of using the
foll
On Jul 26, 8:49 am, gondor wrote:
> I am using admin panel and using get_form to retrieve one of my table
> objects. I have a choicefield in this object but I don't know how to
> set the default. I have saw numerous examples of using the
> following:
>
> class M
I am using admin panel and using get_form to retrieve one of my table
objects. I have a choicefield in this object but I don't know how to
set the default. I have saw numerous examples of using the
following:
class MyAdmin(admin.ModelAdmin):
list_display = ('rank', 'n
The field was being set correctly, but my template did not show this
until now for some reason.
Thomas
On May 3, 5:34 pm, Thomas Allen wrote:
> If I'm instantiating a form, how do I set a ChoiceField value in it?
>
> I have a form with an attribute "role" which I am
If I'm instantiating a form, how do I set a ChoiceField value in it?
I have a form with an attribute "role" which I am setting to the
user's current role, like so:
form = EditUserForm({
'last_name': user.last_name,
'first_name': user.fi
On Apr 30, 4:00 pm, gsnyder2007 wrote:
> I'm looking for a pointer to sample code or advice regarding what is
> the best way to build a form that allows the user to select from
> several options and supply additional textual input that is associated
> with the option they chose, e.g.
>
> choices =
I'm looking for a pointer to sample code or advice regarding what is
the best way to build a form that allows the user to select from
several options and supply additional textual input that is associated
with the option they chose, e.g.
choices = [
('option1', 'value1'), # additional text inp
Can you provide the source code?
The error doesn't make sence.
On Apr 18, 6:15 pm, amyhalf wrote:
> Hi, thanks for the reply!
>
> I changed it to what you suggested but it's mad about something else,
> now:
>
> TemplateSyntaxError
> Caught an exception while rendering: 'ModelChoiceField' object
Hi, thanks for the reply!
I changed it to what you suggested but it's mad about something else,
now:
TemplateSyntaxError
Caught an exception while rendering: 'ModelChoiceField' object has no
attribute 'all'
It's mad about how render it:
{{ form.state }}
I didn't read here (http://docs.djangopr
try with:
class AddressForm(forms.Form):
first_and_last_name = forms.CharField(128, 1)
street1 = forms.CharField(128, 1)
street2 = forms.CharField(128, 1)
city = forms.CharField(64, 1)
state = forms.ModelChoiceField(queryset=States.objects.all())
form = Add
Hi, all!
For the life of me I can't get anything to show up in a drop-down.
Here's the model:
class States(models.Model):
id = models.IntegerField(unique = True, primary_key = True)
abbrev = models.CharField(max_length = 2, blank = False)
long_form = models.CharField(max_
Hi,
I think the problem is tyhat you're using the wrong type of field in your form.
A ChoiceField, like the documentations says [1], returns '' for an
empty value, i.e. when
you do not select an option. Trying to save an empty string into ans
INT field in the database
will thro
That was a very good guess. I tried it but it didn't work.
On Apr 13, 12:46 pm, johan sommerfeld
wrote:
> You could try using initial=0.
>
> /J
>
> On Tuesday, April 13, 2010, geraldcor wrote:
> > Hello all,
>
> > I know the error "invalid literal for int() with base 10: '' " has
> > been discu
You could try using initial=0.
/J
On Tuesday, April 13, 2010, geraldcor wrote:
> Hello all,
>
> I know the error "invalid literal for int() with base 10: '' " has
> been discussed a lot in the past, but this seems to be unique to my
> situation.
>
> I have 2 choice fields as defined below for b
I happened to be stopping by to post my own question, and I don't know
if this is the answer or not, but have you tried adding the argument
blank=True to your model field?
http://docs.djangoproject.com/en/dev/ref/models/fields/#blank
--
You received this message because you are subscribed to the
Hello all,
I know the error "invalid literal for int() with base 10: '' " has
been discussed a lot in the past, but this seems to be unique to my
situation.
I have 2 choice fields as defined below for both the model and form:
models.py
class Checkin(models.Model):
...
content = models.IntegerFie
Very sorry everybody: I googled around tons, but I didn't search this
group! LOL. I'll know next time.
Adding an "invalid" choice to a ChoiceField?
http://groups.google.com/group/django-users/browse_thread/thread/dd6d8eb11f915c94/77aa6fbea94af4c4?lnk=gst&q=choicefiel
Dear All
I have a choiceField in one of my forms, and I'd like to have it
rendered displaying a prompt. I think the html would be something
like this:
Please choose a colour:
Red
Green
Blue
This would display a drop-down menu showing "Pleas
Thanks guys
Both work
Sumanth
On Feb 1, 11:09 pm, Shawn Milochik wrote:
> You can do it in your view after creating the form, if you like.
>
> form = SomeForm()
> form.fields['meal_pref'].initial = 2
>
> Shawn
--
You received this message because you are subscribed to the Google Groups
"Djang
You can do it in your view after creating the form, if you like.
form = SomeForm()
form.fields['meal_pref'].initial = 2
Shawn
--
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.
T
On Tue, Feb 2, 2010 at 8:56 AM, Sumanth wrote:
> Hi all,
>
> I have a basic form
>
> class AssumptionsForm(forms.Form):
> writedownoper = forms.ChoiceField( required=True, choices =
> [('1','1'),('2',2='),('3','3')])
>
> Now in my view after I create the form I want to set value 2 as
> def
Hi all,
I have a basic form
class AssumptionsForm(forms.Form):
writedownoper = forms.ChoiceField( required=True, choices =
[('1','1'),('2',2='),('3','3')])
Now in my view after I create the form I want to set value 2 as
default. How can I do it? Is there set default API that I can use.
have on the
output.
This it would be easy if I could output only
and
separately eg iterating through the single choices of the choicefield,
instead of outputting all the ... block as a whole.
By the way, thank you very much for your help.
separately
On Jan 22, 9:16 pm, Daniel Roseman wrote
On Jan 21, 11:45 pm, pinco wrote:
> The code
>
> {% for choice_value, choice_text in
> myform.fields.choicefieldname.choices %}
> choice_value: {{ choice_value }}
> choice_text: {{ choice_text }}
> {% endfor %}
>
> gives the choices text and values a
The code
{% for choice_value, choice_text in
myform.fields.choicefieldname.choices %}
choice_value: {{ choice_value }}
choice_text: {{ choice_text }}
{% endfor %}
gives the choices text and values associated to each choice, but
actually do not rend
1 - 100 of 215 matches
Mail list logo