hi, I am trying to create such a kind of field in a model. The field
can only take one or more values from a set of value, each seperated
by such as commas. It seems that there is no built-in field type in
Django. How may I implement this? Any clue is greatly appreciated.
Best wishes
Can-Hua
Hi,
> In the quest to build my web sales inventory system, I want to specify
> that only stock that are available be listed in the dropdown.
>
> So my question is can I use a custom query to feed the choices for my field?
Yes. See ModelChoiceField.queryset here:
http://docs.djangopr
Dear all,
In the quest to build my web sales inventory system, I want to specify
that only stock that are available be listed in the dropdown.
So my question is can I use a custom query to feed the choices for my field?
Thank you.
--
Low Kian Seong
blog: http://lowkster.blogspot.com
Karen,
Thank you.
Based on your answer, I continued looking for problems in my code and
in my setup.
Firstly, the strings in the values of the choices were of length 7 and
the CharField was of length 6. I was helped by a coworker to fix that.
Then the problem of not showing the save'd choice
pe requested by the participant. Thus the foreign key to
cert_types. However I need to limit the choices available to those in
its associated activity.
Hmm... now that I think about it, doesn't really seem doable, except
in participations inlined with their activity, where the activity is
known at
On Fri, Oct 17, 2008 at 12:23 AM, AmanKow <[EMAIL PROTECTED]> wrote:
> I need to limit choices dynamically by an object, not a class:
> When adding or changing a
> participation object, either in the admin or via model forms, I need
> to limit the choices for cert typ
I need to limit choices dynamically by an object, not a class:
class CertType(models.Model):
name = models.CharField(max_length=128)
class ActivityTopic(models.Model):
cert_types = models.ManyToMany(CertType)
class Participation(models.Model):
activity_topic = models.ForeignKey
On Thu, Oct 16, 2008 at 1:43 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:
>
> hi,
>
> When I instance a ModelForm with a record of its base model, there is
> a CharField with "choices" that doesn't show the stored value in the
> combobox. Is this expected
hi,
When I instance a ModelForm with a record of its base model, there is
a CharField with "choices" that doesn't show the stored value in the
combobox. Is this expected behaviour?
i'd like it to get instanced as if it were a ForeignKey
best
On Oct 10, 3:08 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> > I think I found a bug.
> You have, but it's in your code, not Django. :-)
brilliant :) yeah I wasn't entirely sure. it smelled like a bug.
> If you look at ReleaseFeedback.get_rating_display at the
> interactive prompt,
On Thu, 2008-10-09 at 07:31 -0700, felix wrote:
> bug?: get_%s_display on CharField with choices (select field)
>
> I think I found a bug.
You have, but it's in your code, not Django. :-)
> I'm using a select input type widget by passing in 'choices' to a
> CharField
>
&
bug?: get_%s_display on CharField with choices (select field)
I think I found a bug.
I'm using a select input type widget by passing in 'choices' to a
CharField
given:
class ReleaseFeedback(models.Model):
RATINGS = ( (1,'*'),(2,'**'),(3,'***'),(4,''),(5,'*') )
rating
I found the same problem as ticket #5737. It was closed due to unable
to reproduce it, but I am seeing the same problem.
I have:
class QueryForm(f.Form):
status = f.ChoiceField(choices=STATUS_TYPES,
widget=f.CheckboxSelectMultiple(), required=False)
and the form validation errored
I just ran into this myself, yesterday and found the solution by
perusing the django source code. Your form class (MyClass) will have
had a field called "fields" created by the meta class of the base
form. That field will have a choices field that you can set. In your
setChoice met
I'm having trouble dynamically assigning the choices to a ChoiceField.
My ChoiceField stores an object's state. In the template pulldown for
this field, I want to restrict the user to only go from stateA to
StateB; from stateB to stateC, etc. Hence the allowable choices need
to be a set based
your form's RadioSelect, i.e.
book_type = forms.ChoiceField(
choices = BOOKCHOICES,
widget=forms.RadioSelect(renderer=RadioFieldRendererSubclass)
)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Gro
construct the form field, it looks like this:
book_type = forms.ChoiceField(
choices = BOOKCHOICES,
widget=forms.RadioSelect(attrs={'onclick':'checkStatus(1)'})
)
And this makes the onclick attribute for every radio button the
same.
So, my questions are:
1. Can
Kool... that fixed it
Thanks
Jim
On Sep 29, 1:23 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 29, 2008 at 2:02 AM, jim <[EMAIL PROTECTED]> wrote:
> > This gives me an error:
> > Cannot resolve keyword 'user' into field. Choices are: xxx
():
user_profile_obj = request.user.get_profile()
...
This gives me an error:
Cannot resolve keyword 'user' into field. Choices are: xxx, yyy, zzz
Any ideas as to what may be causing this?
Thanks
Jim
--~--~-~--~~~---~--~~
You received this message
On Mon, Sep 29, 2008 at 2:02 AM, jim <[EMAIL PROTECTED]> wrote:
> This gives me an error:
> Cannot resolve keyword 'user' into field. Choices are: xxx, yyy, zzz
>
> Any ideas as to what may be causing this?
Your profile model must have a ForeignKey or a OneToOneFiel
):
>
> if request.method == 'POST':
> pass
> else:
> if request.user.is_authenticated():
> user_profile_obj = request.user.get_profile()
> ...
>
> This gives me an error:
> Cannot resolve keyword 'user' into field. Choices are: xxx,
On Tue, Sep 2, 2008 at 12:37 AM, Jon Loyens <[EMAIL PROTECTED]> wrote:
>
> Hi guys,
>
> I have a small project coming up that I think having some sort of
> schema evolution facilities will be handy on. I was wondering what
> the current and best project choices for
Hi guys,
I have a small project coming up that I think having some sort of
schema evolution facilities will be handy on. I was wondering what
the current and best project choices for schema evolution are? I was
leaning towards django-evolution until I saw a post from Russell
saying that he
Thanks! :)
Nick
On Sep 1, 3:18 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Sep 1, 2:53 pm, Nick Day <[EMAIL PROTECTED]> wrote:
>
> > Would somebody be able to provide a simple example of using get_form()
> > within the ModelAdmin to retrieve the currently logged-in user?
>
> > Thanks in
On Sep 1, 2:53 pm, Nick Day <[EMAIL PROTECTED]> wrote:
> Would somebody be able to provide a simple example of using get_form()
> within the ModelAdmin to retrieve the currently logged-in user?
>
> Thanks in advance,
> Nick
>
Not difficult:
class MyAdmin(admin.ModelAdmin):
def
is it possible to limit choices on a website (not using
> ModelAdmin)?
>
> thanks,
> patrick
>
> On Aug 25, 9:35 am, krylatij <[EMAIL PROTECTED]> wrote:
>
> > > There is no longer any reason whatsoever to use this in any way in the
> > > admin.
can someone provide an example for this?
moreover, how is it possible to limit choices on a website (not using
ModelAdmin)?
thanks,
patrick
On Aug 25, 9:35 am, krylatij <[EMAIL PROTECTED]> wrote:
> > There is no longer any reason whatsoever to use this in any way in t
> There is no longer any reason whatsoever to use this in any way in the
> admin. It was an ugly, fragile hack before and it's unnecessary now
> because ModelAdmin has a get_form() method -- which receives the
> HttpRequest object as an argument -- that you can override to tweak
> the form on a
2008/8/25 krylatij <[EMAIL PROTECTED]>:
> You can use ThreadLocals middleware
> http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
> to get current user
No.
There is no longer any reason whatsoever to use this in any way in the
admin. It was an ugly, fragile hack before and it's
On 24 авг, 23:56, "Patrick J. Anderson" <[EMAIL PROTECTED]>
wrote:
> How should I limit choices for ForeignKey fields in admin.ModelAdmin
> instances based on request.user attributes, since I can't pass a request
> object to the forms.ModelForm constructor?
You can us
How should I limit choices for ForeignKey fields in admin.ModelAdmin
instances based on request.user attributes, since I can't pass a request
object to the forms.ModelForm constructor?
--~--~-~--~~~---~--~~
You received this message because you are subscribed
ite.
>>
>> thanks,
>> patrick
>>
>> On Aug 19, 5:48 pm, "Emily Rodgers" <[EMAIL PROTECTED]> wrote:
>>
>>>> -Original Message-
>>>> From: django-users@googlegroups.com
>>>> [mailto:[EMAIL PR
rs@googlegroups.com
> > > [mailto:[EMAIL PROTECTED] On Behalf Of patrickk
> > > Sent: 19 August 2008 14:12
> > > To: Django users
> > > Subject: limit choices to logged-in user
>
> > > is there a way to limit choices (using foreign key) to the
>
the functionality of the site.
thanks,
patrick
On Aug 19, 5:48 pm, "Emily Rodgers" <[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > From: django-users@googlegroups.com
> > [mailto:[EMAIL PROTECTED] On Behalf Of patrickk
> > Sent: 19 August 2008 14:12
> &g
> -Original Message-
> From: django-users@googlegroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of patrickk
> Sent: 19 August 2008 14:12
> To: Django users
> Subject: limit choices to logged-in user
>
>
> is there a way to limit choices (using foreign ke
is there a way to limit choices (using foreign key) to the logged-in
user?
I´ve tried limit_choices_to = {'user': request.user}, but that is
obviously not working since "request" is not available.
any ideas?
thanks,
patrick
--~--~-~--~~~---~--~~
Yo
On Fri, 2008-07-04 at 18:28 -0700, Leaf wrote:
> I'm working on an app called Dj Styles. It generates stylesheets
> dynamically. Anyway, I'm laying out the Style model, and I need to
> know: If you're using the "choices" parameter on a CharField, then
> which do yo
I'm working on an app called Dj Styles. It generates stylesheets
dynamically. Anyway, I'm laying out the Style model, and I need to
know: If you're using the "choices" parameter on a CharField, then
which do you put for the "default" parameter - the value that gets
reco
On Jul 3, 8:13 am, urukay <[EMAIL PROTECTED]> wrote:
> no, no i mean it otherway, just like Rajesh Dhawan wrote (link he sent).
I will rephrase your original question; it's not obvious to everyone
that the REASON you want two of your six choices to be "not
selectab
) and I need the user to chose only
>> one
>> option from the list. Just can't count on that user wil chose to fill
>> only
>> one field with choices if there are more possible fields with choices.
>> And it isn't possible to add to oe field multiple choices lists
2008/7/3, urukay <[EMAIL PROTECTED]>:
>
>
> yes, but it's only for limpidity :) and I need the user to chose only one
> option from the list. Just can't count on that user wil chose to fill only
> one field with choices if there are more possible fields with choices.
>
yes, but it's only for limpidity :) and I need the user to chose only one
option from the list. Just can't count on that user wil chose to fill only
one field with choices if there are more possible fields with choices.
And it isn't possible to add to oe field multiple choices lists (i mena
On Wed, 2008-07-02 at 13:40 -0700, urukay wrote:
>
> is there a way how to create choices in Models in specific way, that some
> choices are not selectable (they only group and describe choices below)?
>
> e.g.:
>
> CHOICES = (
> ('0', 'Basic Colors'),
>
thanks, but i was wondering if it's possible to do that in MODEL?
Rajesh Dhawan wrote:
>
>
>
>
> On Jul 2, 4:40 pm, urukay <[EMAIL PROTECTED]> wrote:
>> is there a way how to create choices in Models in specific way, that some
>> choices are not selecta
On Jul 2, 4:40 pm, urukay <[EMAIL PROTECTED]> wrote:
> is there a way how to create choices in Models in specific way, that some
> choices are not selectable (they only group and describe choices below)?
>
> e.g.:
>
> CHOICES = (
> ('0', 'Basic Colors'),
>
is there a way how to create choices in Models in specific way, that some
choices are not selectable (they only group and describe choices below)?
e.g.:
CHOICES = (
('0', 'Basic Colors'),
('1', 'Red'),
('2', 'Green'),
('3', 'Blue'),
('4', 'Other Colors'),
('5
Daniel Roseman wrote:
> On Jun 29, 2:24 pm, John Aherne <[EMAIL PROTECTED]> wrote:
>
>> OK. I did some more experimenting with ModelChoiceField and my table.
>>
>> Surprise. It worked when I thought it would not. Why did it work. By
>> luck in my model I had the __unicode__ function return the
On Jun 29, 2:24 pm, John Aherne <[EMAIL PROTECTED]> wrote:
> OK. I did some more experimenting with ModelChoiceField and my table.
>
> Surprise. It worked when I thought it would not. Why did it work. By
> luck in my model I had the __unicode__ function return the right value.
> So now I could
ist filled. Once again my model
>>> has 10 fields, but I only want to get 2 of those to use in my selection
>>> list.
>>>
>>> I thought about filling out a dictionary and passing that in as per the
>>> samples in forms.py. But I then read that I should not be
sion data. At the moment, I'm
>> not using session data, I just want to hardcode the options so I can
>> concentrate on how I get my selection list filled. Once again my model
>> has 10 fields, but I only want to get 2 of those to use in my selection
>> list.
>>
>&
rate on how I get my selection list filled. Once again my model
> has 10 fields, but I only want to get 2 of those to use in my selection
> list.
>
> I thought about filling out a dictionary and passing that in as per the
> samples in forms.py. But I then read that I should not be do
filling out a dictionary and passing that in as per the
samples in forms.py. But I then read that I should not be doing this.
Choices in forms is for mainly static selections. So I then start
looking for a way to get my data set up for a selection list. But as I
say, I've looked
You da man. This worked perfectly out of the box. Thank you!
On Jun 19, 5:54 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> On Jun 19, 3:45 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
>
> > if self.instance.state == 'processing':
> > queryset =
On Jun 19, 3:45 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> if self.instance.state == 'processing':
> queryset = queryset.exclude(state='new')
The above lines aren't quite right ``self.instance`` is an instance of
your ``SomeModel`` and presuming
On Jun 19, 3:23 pm, Huuuze <[EMAIL PROTECTED]> wrote:
> In this example, what if you wanted to selectively remove a value from
> the choice list.
For that you'll have to move the field declaration into the form's
__init__ method::
class SomeForm(forms.ModelForm):
class Meta:
In this example, what if you wanted to selectively remove a value from
the choice list. For example, let's say the list contained New, In
Process, and Closed. When an item is "In Process", it cannot revert
back to "New". As such, "New" should not be displayed amon
Hmm I would also be interested if anyone knows how to do this.
On Jun 17, 3:05 pm, mbdtsmh <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I have a question for you all that has been discussed before but I
> cannot figure out the best way to go about implementing.
>
> I have the following
Hello everyone,
I have a question for you all that has been discussed before but I
cannot figure out the best way to go about implementing.
I have the following model:
class DesignSet(models.Model):
priority=models.ForeignKey(Priority)
status=models.ForeignKey(Status,
Great! A cleaner solution. Thanks!
Is there any effort underway for making overriding default widgets
simpler? I think that's really needed (especially for beginner like
me).
2B
On Jun 8, 1:20 am, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote:
> On Jun 7, 4:18 pm, Berco Beute <[EMAIL
On Jun 7, 4:18 pm, Berco Beute <[EMAIL PROTECTED]> wrote:
> Quite a lot of work for something so simple
I agree that overriding default widgets is currently too much work.
But here's a slightly shorter version that works in exactly the same
way as your example::
class
On Jun 5, 7:36 am, Berco Beute <[EMAIL PROTECTED]> wrote:
> My model has a ForeignKey that renders as a SELECT field in HTML. The
> problem is that there's an empty value ('-') that I would like
> to hide.
Presuming you are using newforms (i.e. not the Admin), then override
the
My model has a ForeignKey that renders as a SELECT field in HTML. The
problem is that there's an empty value ('-') that I would like
to hide. I've tried adding 'null=False' and 'blank=False' to the
ForeignKey but the empty value still appears. Any suggestions?
2B
In the meantime I did the following:
def save(self):
try:
self.score = int(self.score)
except:
pass
super(Entry, self).save()
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
On May 22, 6:29 am, "Scott Moonen" <[EMAIL PROTECTED]> wrote:
> I suspect your problem may be due to the fact that your display value for 3
> is a number rather than a string. Try changing:
>
> CHOICES = [(1, '1'), (2, '2'), (3, 3), (4, '4'), (5, '5')]
>
>
I suspect your problem may be due to the fact that your display value for 3
is a number rather than a string. Try changing:
CHOICES = [(1, '1'), (2, '2'), (3, 3), (4, '4'), (5, '5')]
to
CHOICES = [(1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5')]
-- Scott
On Wed, May 21, 2008 at 7
Jashugan wrote:
> Hello I have the following code in my model:
>
> class SomeMode(models.Model):
>
> CHOICES = [(1, '1'), (2, '2'), (3, 3), (4, '4'), (5, '5')]
>
> score = models.IntegerField(choices=CHOICES)
>
>
> When I change the score in the admin
Hello I have the following code in my model:
class SomeMode(models.Model):
CHOICES = [(1, '1'), (2, '2'), (3, 3), (4, '4'), (5, '5')]
score = models.IntegerField(choices=CHOICES)
When I change the score in the admin interface it throws this error:
an integer is required
I think
ocs are somewhat incomplete - they only explain
> how to set the initial queryset. I've been meaning to write up some
> documentation explaining the .queryset attribute, so thanks for
> spurring some action :)
>
> Adam
>
> On Tue, May 20, 2008 at 8:59 AM, chylld <[EMAIL PROTECTED]>
have exactly the same problem; I just want to fill the ChoiceField
> with a certain subset of choices based on the current user. Have you
> found a way to do this??
>
> Jonathan
>
>
> On Apr 10, 7:21 am, ydjango <[EMAIL PROTECTED]> wrote:
>> Yes, They are defined
I have exactly the same problem; I just want to fill the ChoiceField
with a certain subset of choices based on the current user. Have you
found a way to do this??
Jonathan
On Apr 10, 7:21 am, ydjango <[EMAIL PROTECTED]> wrote:
> Yes, They are defined in model as
>
> owner = mo
the
field's _choices property with the options sorted to my liking. I can
provide the necessary code samples, if anyone is interested.
On Apr 25, 11:57 pm, dimrub <[EMAIL PROTECTED]> wrote:
> 2. Is there a way to sort the order of the choices dynamically (e.g.,
> based on the current us
imrub <[EMAIL PROTECTED]> wrote:
> Greetings, all!
>
> Two (possibly - trivial) questions regarding a field that has
> 'choices' defined for it.
>
> 1. Is there a way to specify a special choice, upon which another
> field becomes active? A typical use case is to have a certain
On Apr 25, 11:57 pm, dimrub <[EMAIL PROTECTED]> wrote:
> Greetings, all!
>
Oh, forgot to mention: I'm trying to use admin views. I do realize
question #2 has a trivial solution if a non-admin view is used (and,
come to think of it, #1 does as well).
Greetings, all!
Two (possibly - trivial) questions regarding a field that has
'choices' defined for it.
1. Is there a way to specify a special choice, upon which another
field becomes active? A typical use case is to have a certain set of
predefined values (out of which the user will USUALLY
setting it to a value existing in
> a related model doesn't help me to get rid of blank value.
>
> Is there any way to do that, other than manually generating choices:
> In AnObjectForm's __init__:
>
> self.fields['object_category'].widget =
> forms.RadioSel
ially selected instead)." Blank is True and default
doesn't make sense here... but even setting it to a value existing in
a related model doesn't help me to get rid of blank value.
Is there any way to do that, other than manually generating choices:
In AnObjectForm's __init__:
s
Rodrigo,
I've found this to be a common use-case among many projects of mine.
The admin becomes completely unusable if you have hundreds of
thousands of possibilities for ForeignKey and/or ManyToMany
relations. I've created a `ModelAdmin` (newforms-admin) subclass
called `LimitedRelatedAdmin`
Richard,
I see your point, but there could be many, many issues for each
magazine, and over a hundred magazines total, so I don't want to make
the users wade through a few thousand issues each time. I'd like to be
able to drill down, first pick a magazine, then one of its issues.
What I'm
This is where I would suggest you rethink your data model. Is there a
reason to link Article to both Issues and Magazine?
Why not something like:
Issues has FK (magazine) to Magazine
Articles has FK (issue) to Issues
Issues could be configured to return its magazine.title and
self.issue_number
I have 3 models: Magazine, Issue and Article.
Each Magazine has 1 or more Issues and each Issue has 1 or more
Articles.
Article has models.ForeignKey(Issue) and models.ForeignKey(Magazine).
Issue has models.ForeignKey(Magazine)).
In the admin, when creating a new article, I choose which Magazine
lf a few hours
> > > of pulling my hair out.
> >
> > > Best,
> >
> > > ROn Wed, Apr 9, 2008 at 11:19 PM, Justin <[EMAIL PROTECTED]> wrote:
> >
> > > > I noticed when looking at some code that after setting the queryset,
> >
> it appears in the form. I can call ._get_queryset() or .queryset and
> > > it looks updated.
>
> > > The problem occurs in the actual form rendered.
>
> > > form.as_ul() does not have the updated choices for the checkbox. I'm
> > > digging through
nd
> > it looks updated.
>
> > The problem occurs in the actual form rendered.
>
> > form.as_ul() does not have the updated choices for the checkbox. I'm
> > digging through django code but still nothing.
>
> > On Apr 8, 11:05 pm, Justin <[EMAIL PROTECTED]&g
ul() does not have the updated choices for the checkbox. I'm
> digging through django code but still nothing.
>
>
>
> On Apr 8, 11:05 pm, Justin <[EMAIL PROTECTED]> wrote:
> > I have a form:
> >
> > class TestForm(forms.Form):
> >
On Wed, Apr 9, 2008 at 4:21 PM, ydjango <[EMAIL PROTECTED]> wrote:
> owner = models.ForeignKey(Participant,null=True)
Not the *model* fields, the *form* fields for representing this type
of relationship.
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."
Yes, They are defined in model as
owner = models.ForeignKey(Participant,null=True)
all I want is to display only the Partcipants for a particular group
in the choice field ( not all participants)
and I am so frustrated now.
eg. Participant.objects.filter(group__exact=my_group)]
thanks
Ashish
On Wed, Apr 9, 2008 at 3:30 PM, ydjango <[EMAIL PROTECTED]> wrote:
> Miles and Owner are defined as foreign_key to respective tables.
Yes, but did you actually look at the docs for the field types that
make it easy to represent foreign keys?
--
"Bureaucrat Conrad, you are technically correct
e tried everything in code below, passing choices , queryset,
> changing to choicefield etc. It just ignores everything and gets data
> from __unicode_ function for the foreign key table - all rows. (
> I am learning Python through Django, so may be I am making some python
> newbie mis
for Miles, owner,
All I need is subset of data.
I have tried everything in code below, passing choices , queryset,
changing to choicefield etc. It just ignores everything and gets data
from __unicode_ function for the foreign key table - all rows. (
I am learning Python through Django, so may
On Wed, Apr 9, 2008 at 2:56 PM, ydjango <[EMAIL PROTECTED]> wrote:
> Not for model form, if a ChoiceField is based on foreign Key. It is
> getting values from the referenced table using the __unicode__ method
> in that table and ignoring the choices field passed to it.
N
Not for model form, if a ChoiceField is based on foreign Key. It is
getting values from the referenced table using the __unicode__ method
in that table and ignoring the choices field passed to it.
On Mar 27, 7:57 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Thu, Mar
I noticed when looking at some code that after setting the queryset,
it appears in the form. I can call ._get_queryset() or .queryset and
it looks updated.
The problem occurs in the actual form rendered.
form.as_ul() does not have the updated choices for the checkbox. I'm
digging through
Task.objects.none().
If I hit F5 to reload, the correct tasks based on the project show
up. I can hit F5 infinitely and it's correct. It's only on that
first load.
More weird... I click back out to a different project page. When I
click the link, I expect it to show the form with a new set o
ed in my template as Radio Buttons. So I
> > added the line ' experience =
> > forms.CharField(widget=forms.RadioSelect) ' to my ModelClass.
> > However, when I do this then my SATISFACTION choices don't get
> > displayed in my template.
>
> > My Models File
>
&g
ttons. So I
> added the line ' experience =
> forms.CharField(widget=forms.RadioSelect) ' to my ModelClass.
> However, when I do this then my SATISFACTION choices don't get
> displayed in my template.
>
> My Models File
>
> SATISFACTION = (
> ('1', 'Agree'),('2',
.
However, when I do this then my SATISFACTION choices don't get
displayed in my template.
My Models File
SATISFACTION = (
('1', 'Agree'),('2', 'Disagree'),
)
class Survey(models.Model):
experience = models.CharField(max_length=100,
choices=SATISFACTION)
My ModelForm class
class
On Mon, 2008-02-04 at 11:22 -0800, [EMAIL PROTECTED] wrote:
> I'm talking about this kind of choices field
> http://www.djangoproject.com/documentation/model-api/#choices
>
> e.g.
> class Foo(models.Model):
> GENDER_CHOICES = (
> ('M', 'Male'),
&g
> )
> gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
>
> Is there a reason to not mirror the actual value stored with the human
> readable one? Are you buying much by having a single character rather
> than around 20 or 30?
Right..you should see no p
I'm talking about this kind of choices field
http://www.djangoproject.com/documentation/model-api/#choices
e.g.
class Foo(models.Model):
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES
I have mod_python and I'm using ModelChoiceField, but I'm not getting
the expected results, when I change my queryset and the second has
elements not present on the original queryset, it displays the choices
but doesn't validate properly, complaining about the option not being
valid for the set
501 - 600 of 857 matches
Mail list logo