On Feb 21, 6:11 am, Mario Gudelj wrote:
> not sure what you mean there,
I have a class that inherits from Model, and I want my field to be in
that class.
> but take a look at
> thishttps://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield
That looks to be for foreign key referen
not sure what you mean there, but take a look at this
https://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield
On 21 February 2012 23:36, larry.mart...@gmail.com
wrote:
> On Feb 20, 9:52 pm, Mario Gudelj wrote:
> > Hey there,
> >
> > Try this:
> >
> > In your forms.py create a fi
On Feb 20, 9:52 pm, Mario Gudelj wrote:
> Hey there,
>
> Try this:
>
> In your forms.py create a field such as this
>
> message = forms.ChoiceField(label='Event Type', choices=EVENT_TYPE_CHOICES)
>
> That will create a dropdown.
My app does not have a forms.py file. I know I can just create one,
Hey there,
Try this:
In your forms.py create a field such as this
message = forms.ChoiceField(label='Event Type', choices=EVENT_TYPE_CHOICES)
That will create a dropdown.
Also, I think that the first thing in the tuple is a value and shouldn't
have a space, so change:
EVENT_TYPE_CHOICES = (('
On Feb 20, 5:54 pm, Anurag Chourasia
wrote:
> This is weird
>
> I simply copy pasted your code in my environment and it shows me a Drop
> Down.
>
> Could you save the models file again and close your browser (or even try
> clearing cache) and restart your apache/django dev server whatever may
Your code looks good to me.
Maybe you need to restart apache (or similar)?
This is typically the format I use for choice fields:
LIVE_STATUS = 1
DRAFT_STATUS = 2
HIDDEN_STATUS = 3
STATUS_CHOICES = (
(LIVE_STATUS, u'Live'),
(DRAFT_STATUS, u'Draft'),
(HIDDEN_STATUS, u'Hidden'),
)
statu
This is weird
I simply copy pasted your code in my environment and it shows me a Drop
Down.
Could you save the models file again and close your browser (or even try
clearing cache) and restart your apache/django dev server whatever may be
the case and try again?
Regards,
Anurag
On Mon, Feb
On Feb 20, 5:39 pm, Stanwin Siow wrote:
> Try removing
>
> "Event Type",
>
> in the following
>
> message = models.CharField("Event Type", max_length=12,
> choices=EVENT_TYPE_CHOICES)
>
> Best Regards,
>
> Stanwin Siow
No difference.
>
> On Feb 21, 2012, at 8:32 AM, larry.mart...@gmail.com wro
Try removing
"Event Type",
in the following
message = models.CharField("Event Type", max_length=12,
choices=EVENT_TYPE_CHOICES)
Best Regards,
Stanwin Siow
On Feb 21, 2012, at 8:32 AM, larry.mart...@gmail.com wrote:
> ield("Event Type", max_length=12,
> choices=EVENT_TYPE_CHOICES)
--
You
I'm fairly new to django, still getting my feet wet. I want to have a
dropdown menu (django seems to call this a select box). I read this:
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.choices
So I did this:
class EventsTable(models.Model):
EVENT_TYPE_CHOICE
10 matches
Mail list logo