the choices parameter in the ChoiceField declaration
to be derived from a query result from SQLAlchemy (returned as an
array of tuples). The problem is that the choices don't update when
the database changes. They are fixed to whatever was present when the
server is initialized (or at least it appears
s
>
> models.py
>
> class Foo(models.Model):
>GENDER_CHOICES = (
>('M', 'Male'),
>('F', 'Female'),
>)
> gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
>
>
> On Jul 20, 11
= models.CharField(max_length=1, choices=GENDER_CHOICES)
On Jul 20, 11:24 pm, Saketh <saketh.bhamidip...@gmail.com> wrote:
> Hi everyone,
>
> I am making a user settings page for my application based on django-
> registration and django-profiles, but I'm running into a small problem
Hi everyone,
I am making a user settings page for my application based on django-
registration and django-profiles, but I'm running into a small problem
in how I'd like the page to be laid out.
My data model has a field that can take on only three values, 'A',
'B', and 'C'. I have modeled this
On Jul 13, 10:03 am, itodd <tohh...@gmail.com> wrote:
> Greetings,
>
> I'm trying to use a SelectMultiple with a set of static choices. I'm
> experiencing odd behavior when the number of choices exceeds 10. For
> example, take the following Model and ModelForm:
>
>
Greetings,
I'm trying to use a SelectMultiple with a set of static choices. I'm
experiencing odd behavior when the number of choices exceeds 10. For
example, take the following Model and ModelForm:
class Project(models.Model):
RECIPIENTS = (
(1,'Brad'),
(2,'Fred
Hi
I have that choice field:
RATES = (
('1', '1'),
('2', '2'),
('3', '3'),
('4', '4'),
('5', '5'),
)
rating = forms.ChoiceField(widget=forms.RadioSelect(), required=True,
choices=RATES)
Now - how to assign attrs for all choices(for example apply css
Hi,
how does your view looks like?
why you're unable to set initial data for the form?
Radovan
firebug wrote:
>
>
> Hi,
>
> I want to limit the choice of ChoiceField to a predefined value, if
> the value from POST does not exist in given choices. How this could be
>
Hi,
I want to limit the choice of ChoiceField to a predefined value, if
the value from POST does not exist in given choices. How this could be
done easily? I don't want to modify the POST-dictionary before it is
passed to the form instance, because I would have to write same code
all over
Alex Gaynor wrote:
>
>
> On Tue, Jul 7, 2009 at 12:16 AM, Magnus Valle <li...@negativehalf.com
> <mailto:li...@negativehalf.com>> wrote:
>
>
> I have a CharField model with nested choices, like this one:
>
> MEDIA_CHOICES = (
>('A
On Tue, Jul 7, 2009 at 12:16 AM, Magnus Valle <li...@negativehalf.com>wrote:
>
> I have a CharField model with nested choices, like this one:
>
> MEDIA_CHOICES = (
>('Audio', (
>('vinyl', 'Vinyl'),
>('cd', 'CD'),
>)
>),
&g
I have a CharField model with nested choices, like this one:
MEDIA_CHOICES = (
('Audio', (
('vinyl', 'Vinyl'),
('cd', 'CD'),
)
),
('Video', (
('vhs', 'VHS Tape'),
('dvd', 'DVD'),
)
),
('unknown', 'Unknown
I am sorry folks, I just found the corresponding issue:
http://code.djangoproject.com/ticket/9245
however, i would still be interested in discussing the reasons behind
this - and why the patch provided in the ticket did't get applied
yet ;)
flo
Hi all,
I am trying to implement a "FlagField" that can be used to store
binary flags in a single integer value in the DB. The approach that
looks most promising is subclassing Integer Field, pass in some
choices as possible flags (which will be internally converted into the
appropriat
Thank you sir. I got this from "Python Web Dev. w/ Django".
An unforseen side effect.
ryan
On Jun 2, 12:05 pm, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On Jun 2, 4:53 pm, ryan <writepyt...@gmail.com> wrote:
>
> > This additional model, which
On Jun 2, 4:53 pm, ryan <writepyt...@gmail.com> wrote:
> This additional model, which uses the same choices is emptying the
> choices dropdown of both User with inline UserProfile and UserProfile
> itself. Add it prior to UserProfile in models.py of your test app:
>
> clas
This additional model, which uses the same choices is emptying the
choices dropdown of both User with inline UserProfile and UserProfile
itself. Add it prior to UserProfile in models.py of your test app:
class Person(models.Model):
sales_team = models.IntegerField(choices=SALES_TEAM_CHOICES
On Tue, Jun 2, 2009 at 10:59 AM, ryan <writepyt...@gmail.com> wrote:
>
> When I edit a User in the admin, the sales_team and user_class
> dropdowns are empty.
>
> If anyone can point out my error or point me to the django core code
> that ignores the choices, I
When I edit a User in the admin, the sales_team and user_class
dropdowns are empty.
If anyone can point out my error or point me to the django core code
that ignores the choices, I would greatly appreciate it.
#models.py
SALES_TEAM_CHOICES = enumerate(('CLS','CCS','TPS'))
USER_CLASS_CHOICES
Thanks v
What you said echoes what I found on a posting on djangosnippet.org
about populating the choices in the init field. It works fine now.
On May 26, 9:30 am, V <viktor.n...@gmail.com> wrote:
> On May 25, 1:27 pm, Simon Davies <simon...@gmail.com> wrote:
>
>
>
&g
On May 25, 1:27 pm, Simon Davies <simon...@gmail.com> wrote:
> I have a choices field called status in my model form which can be set
> to a number of values, however the options available will be based on
> its current state something like this, so it needs to refer to it
I have a choices field called status in my model form which can be set
to a number of values, however the options available will be based on
its current state something like this, so it needs to refer to itself:
class ContractForm(ModelForm):
def getStatusChoices()
if status == 'r
On Sun, 2009-05-17 at 20:01 -0700, Bobby Roberts wrote:
> yeah i'm still lost...
You don't need to change your form, just use form.cleaned_data in your
view. Same example, a few more lines:
>>> # our form
...
>>> from django import forms
>>> from django.contrib.auth.models import User
>>>
>>>
> You should be looking in cleaned_data, see:
>
> http://docs.djangoproject.com/en/1.0/topics/forms/#processing-the-dat...
>
> For a ModelMultipleChoiceField, cleaned_data will be a list of model
> instances. You shouldn't even have to think about the pk s.
>
> sdc
yeah i'm still lost... this is
On Sun, 2009-05-17 at 18:43 -0700, Bobby Roberts wrote:
> in my view i have this:
>
>
> if request.method=='POST':
> form=FrmIdMessage(request.POST)
> if form.is_valid(): #process valid form here
> assert False, request.POST.get('posted_to','')
> [snip]
You
On May 17, 4:23 pm, Bobby Roberts wrote:
> > ... users = forms.ModelMultipleChoiceField(
> > ... queryset=User.objects,
> > ... widget=forms.CheckboxSelectMultiple,
> > ... required=True)
> > ...>>> User(username='sdc').save()
> > >>>
On May 17, 4:23 pm, Bobby Roberts wrote:
> > ... users = forms.ModelMultipleChoiceField(
> > ... queryset=User.objects,
> > ... widget=forms.CheckboxSelectMultiple,
> > ... required=True)
> > ...>>> User(username='sdc').save()
> > >>>
On May 17, 4:23 pm, Bobby Roberts wrote:
> > ... users = forms.ModelMultipleChoiceField(
> > ... queryset=User.objects,
> > ... widget=forms.CheckboxSelectMultiple,
> > ... required=True)
> > ...>>> User(username='sdc').save()
> > >>>
.id]='%s %s' %(i.first_name,i.last_name)
> return self.items()
>
> #used to post messages to oher users
> class FrmIdMessage (forms.Form):
> posted_to = forms.ChoiceField
> (required=True,widget=forms.CheckboxSelectMultiple(attrs=
> {'class':'optchecklist'},choices=myuser
> ... users = forms.ModelMultipleChoiceField(
> ... queryset=User.objects,
> ... widget=forms.CheckboxSelectMultiple,
> ... required=True)
> ...>>> User(username='sdc').save()
> >>> User(username='bobby').save()
dude you rock... i totally missed this. Does exactly
.CheckboxSelectMultiple(attrs=
{'class':'optchecklist'},choices=myuserlist(userdata)))
message = forms.CharField (max_length=300, required=True,
widget=forms.Textarea(attrs={'class':'smallblob'}))
~
--~--~-~--~~~---~--~~
You received this message because you
to post messages to oher users
> class FrmIdMessage (forms.Form):
> posted_to = forms.ChoiceField
> (required=True,widget=forms.CheckboxSelectMultiple(attrs=
> {'class':'optchecklist'},choices=myuserlist(userdata)))
> message = forms.CharField (max_length=300, require
> Try this below code. I guess this will solve your purpose
>
> # pull a recordset of the users
> userdata = auth_user.objects.all()
>
> def user_filler(self):
> for i in userdata:
> self[i.id] = '%s, %s', (i.firstname, i.lastname)
> return self.items()
>
from django
> > incr = 0
> > for i in p:
> > self[incr] = i.country
> > incr = incr+1
> > return self.items()
>
> > country = forms.CharField(label="cnty",
> > widget=forms.CheckboxSelectMultiple(choices=country_filler
> &g
ntry
> incr = incr+1
> return self.items()
>
> country = forms.CharField(label="cnty",
> widget=forms.CheckboxSelectMultiple(choices=country_filler
> (country_list)))
>
ok here's what i have based on that example:
from django import forms
# pull a reco
,
> Lokesh
>
> > >incr = 0
> > >for i in p:
> > > self[incr] = i.country
> > > incr = incr+1
> > >return self.items()
> >
> > > country = forms.CharField(label="cnty",
> > > widget=form
> > return self.items()
>
> > country = forms.CharField(label="cnty",
> > widget=forms.CheckboxSelectMultiple(choices=country_filler
> > (country_list)))
>
> > Hope the above lines will help you.
>
> > Regards,
> > Lokesh
>
> >
ch from the records
>incr = 0
>for i in p:
> self[incr] = i.country
> incr = incr+1
>return self.items()
>
> country = forms.CharField(label="cnty",
> widget=forms.CheckboxSelectMultiple(choices=country_filler
> (country_list)))
>
> H
return self.items()
country = forms.CharField(label="cnty",
widget=forms.CheckboxSelectMultiple(choices=country_filler
(country_list)))
Hope the above lines will help you.
Regards,
Lokesh
On May 17, 7:10 pm, Bobby Roberts <tchend...@gmail.com> wrote:
> Hi. I'm needing to learn how
Hi. I'm needing to learn how to dynamically pull data out of the
database and pass it as a CHOICES argument in my form. I want to pull
a recordset of options, dump it into the choices and pass it to the
form etc. Can someone out there lend me a hand? I'd like the options
on the form
related_name='t_release', null=True, blank=True)
> > a_release = models.ForeignKey(Release,
> > verbose_name="A-Environment",
> > related_name='a_release', null=True, blank=True)
> > p_release = models.ForeignKey(Release,
> > verbose_name="P-Environme
works in the admin interface, i can select Releases for each
> OTAP i have for each of the 4 environments. However i would like to
> limit the choices of the environments to just those releases that
> belong to that OTAP. I've tried to work with the 'limit_choices_to'
> from the
yes, gotcha - that makes sense. Thanks.
Margie
On May 7, 10:59 pm, George Song <geo...@damacy.net> wrote:
> On 5/7/2009 9:19 PM, Margie wrote:
>
>
>
> > Thanks much George, that was a big help. I have some "proof of
> > concept code below" that
On 5/7/2009 9:19 PM, Margie wrote:
> Thanks much George, that was a big help. I have some "proof of
> concept code below" that simply limits choices to the first four
> users, and I have verified that that works.
>
> class TaskAdmin(admin.ModelAdmin):
>
>
Thanks much George, that was a big help. I have some "proof of
concept code below" that simply limits choices to the first four
users, and I have verified that that works.
class TaskAdmin(admin.ModelAdmin):
def formfield_for_dbfield(self, db_field, **kwargs):
if db_
s.Model):
> owner = models.ForeignKey('auth.User')
> resources = models.ManyToManyField('auth.User')
>
> The resources field identifies the set of possible owners for the
> task. I would like to have the admin change_list view show the
> resources as the choices for the owner field, ra
= models.ManyToManyField('auth.User')
The resources field identifies the set of possible owners for the
task. I would like to have the admin change_list view show the
resources as the choices for the owner field, rather than showing all
Users.
Has anyone had success doing this? Can someone point me in the right
Hi,
I have a model with a number of fields that use Django's 'choices'
attribute, to limit the allowed values of those fields to a
pre-defined list. I assumed that the Model system would validate my
fields when I create or update them, to ensure that invalid choices
weren't being assigned
I have the same problem and am hoping that a solution to one will work
for both of us. In my case, I am working on an online newspaper site.
My models for this particular app are Issue and Article. Articles are
assigned to Issues so that they can all be published when the issue is
published. That
Hello all,
I'm wondering if the following behavior is a feature, a bug, or a
coding error on my part: when I define a model with a CharField that
has choices, if I later save an instance of the model with a value for
that field which is not one of the choices, the value does not display
all works in the admin interface, i can select Releases for each
OTAP i have for each of the 4 environments. However i would like to
limit the choices of the environments to just those releases that
belong to that OTAP. I've tried to work with the 'limit_choices_to'
from the ForeignKey, but i've
ntent_type = models.ForeignKey(ContentType, limit_choices_to=
> {'id__in': CONTENT_TYPE_CHOICES})
>
>
> On Apr 1, 11:48 am, Lee <leetr...@gmail.com> wrote:
> > You're close...
> >
> > change your method in CHOICES to get_for_model( _model_ )
> >
(ContentType, limit_choices_to=
{'id__in': CONTENT_TYPE_CHOICES})
On Apr 1, 11:48 am, Lee <leetr...@gmail.com> wrote:
> You're close...
>
> change your method in CHOICES to get_for_model( _model_ )
>
> So it should be
> CHOICES = (
> (ContentType.objects.get_fo
Thanks for the info. I also ran across 'limit_choices_to' which also
works.
On Wed, 2009-04-01 at 08:48 -0700, Lee wrote:
> You're close...
>
> change your method in CHOICES to get_for_model( _model_ )
>
> So it should be
> CHOICES = (
> (ContentType.objects.g
You're close...
change your method in CHOICES to get_for_model( _model_ )
So it should be
CHOICES = (
(ContentType.objects.get_for_model(My_Model), "Model 1"),
(ContentType.objects.get_for_model(My_Other_Model), "Model
2"),
)
Obviously, make sure y
Thanks for the hints guys. It works now.
:-)
On Mar 28, 12:49 am, Stephan John <em...@stephanjohn.de> wrote:
> Am Freitag, 27. März 2009 14:43:08 schriebJoshuaPartogi:
>
> > bel = forms.ChoiceField(choices=({'one':'one','two':'two'}) )
>
> it must be tuples:
>
> b
Hi.
Choices is a tuple/list of tuples/lists, so in your case it would look
like this:
(('one', 'one'), ('two', 'two'))
You can't use dictionaries.
~Jakob
On 27 Mar., 14:43, Joshua Partogi <joshua.j...@gmail.com> wrote:
> Hi all,
>
> Let me just get straight to the point
> I tr
Am Freitag, 27. März 2009 14:43:08 schrieb Joshua Partogi:
> bel = forms.ChoiceField(choices=({'one':'one','two':'two'}) )
it must be tuples:
bel = forms.ChoiceField(choices=(('one', 'one'), ('two', 'two' ) )
--~--~-~--~~~---~--~~
You received this mess
Hi all,
Let me just get straight to the point
I tried these:
label = forms.ChoiceField(choices=({'one':'one','two':'two'}) )
And received these:
Exception Type: TemplateSyntaxError
Exception Value:Caught an exception while rendering: too many values to
unpack
What was wrong
> In my models, I'm trying to limit the choices of a field based on the
> data stored in a field in the user profile table.
You will want to define these limits in your forms rather than in the
models.
> However, I have not been successful. I'm trying to learn Django, so
> I'm still
Hi!
In my models, I'm trying to limit the choices of a field based on the
data stored in a field in the user profile table.
However, I have not been successful. I'm trying to learn Django, so
I'm still a noob when it comes to it.
Also, is the user profile table supposed to have an id field
Trying to create a generic FK using ContentType. In admin, the menu
lists all the models. Since I only ever need to select 1 of 2 different
models, anyway to limit the choice?
Setting the choices attribute as Django complains
must be a "ContentType" instance
ContentType.o
I think I'm going to try to come up with a more exact example of what
I'm doing. I spent all last evening on this - could just not get the
initial values set on my ModelMultipleChoiceForm. I guess I'll have
to back up and start using a manage.py shell and pdb and step thrrough
the django code
On Feb 24, 5:09 am, Margie wrote:
> Ok - I think I should actually be using initial - but still haven't
> gotten that to actually work. I'm trying something like this:
>
> In models.py
> class Book(models.Model):
> title = models.CharField(max_length=100)
>
Ok - I think I should actually be using initial - but still haven't
gotten that to actually work. I'm trying something like this:
In models.py
class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
pulisher =
Let's say I have a model like this:
class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
pulisher = models.ForeignKey(Publisher, blank=True, null=True)
I want to generate a form that can be used to edit an existing Book
object.
On Thu, Feb 12, 2009 at 3:49 PM, Michael Repucci wrote:
>
> Oh, bummer. Is there a *not so good* way to do it in 1.0.2? It'd be
> nice to do it at all.
>
> Or is it perhaps not as scary as I think (as a newbie) to use the
> latest development version?
>
> On Feb 12, 3:35 pm,
Oh, bummer. Is there a *not so good* way to do it in 1.0.2? It'd be
nice to do it at all.
Or is it perhaps not as scary as I think (as a newbie) to use the
latest development version?
On Feb 12, 3:35 pm, Alex Gaynor wrote:
> On Thu, Feb 12, 2009 at 3:33 PM, Michael
On Thu, Feb 12, 2009 at 3:33 PM, Michael Repucci wrote:
>
> It seems that the formfield_for_dbfield method doesn't have a hook for
> the request. So unless I'm mistaken, I can't use it to filter the
> Contact instances by the currently logged in user (request.user). Any
>
It seems that the formfield_for_dbfield method doesn't have a hook for
the request. So unless I'm mistaken, I can't use it to filter the
Contact instances by the currently logged in user (request.user). Any
other thoughts?
On Feb 12, 3:12 pm, Michael Repucci wrote:
> Oh. It
On Thu, Feb 12, 2009 at 3:12 PM, Michael Repucci wrote:
>
> Oh. It doesn't mention that in the documentation. I am using 1.0.2-
> final. I'll check out formfield_for_dbfield. Thanks for the pointer!
>
> On Feb 12, 3:09 pm, Alex Gaynor wrote:
> > On
Oh. It doesn't mention that in the documentation. I am using 1.0.2-
final. I'll check out formfield_for_dbfield. Thanks for the pointer!
On Feb 12, 3:09 pm, Alex Gaynor wrote:
> On Thu, Feb 12, 2009 at 3:07 PM, Michael Repucci wrote:
>
>
>
>
>
> > I'm
On Thu, Feb 12, 2009 at 3:07 PM, Michael Repucci wrote:
>
> I'm new to Django, and already loving it. But I'm stumbling a bit with
> how to accomplish the following task. Perhaps this isn't the best
> approach, but most of the site is working as planned, and it was super
>
I'm new to Django, and already loving it. But I'm stumbling a bit with
how to accomplish the following task. Perhaps this isn't the best
approach, but most of the site is working as planned, and it was super
easy to get up and running.
I have a Contact model and a Person model, the latter of
On Mon, 2009-01-26 at 14:20 -0800, Jeromie wrote:
> I have a model with a status field that includes a choices argument to
> provide human readable options. Because the options were changing
> during development, the values stored in the database are rather
> generic - S01, S02, etc.
I have a model with a status field that includes a choices argument to
provide human readable options. Because the options were changing
during development, the values stored in the database are rather
generic - S01, S02, etc. There is one view in my application that
provides a list of all
eignkeyfield toselectthe
> ResourceType, and a ManyToManyField to link to the Resource
> model.
>
> I would like the user to be able to enter the dates to and from, andselectthe
> resource type. Then from these choices this would only show
> those resources available that
interestingly changing candidate = request.candidate (retrieved from
middleware) to candidate = Candidate.objects.filter(user=request.user)
and then doing .delete() works.
Very strange behaviour. I don't understand the ORM well enough to know
why it would get confused.
On Jan 12, 2:43 pm,
and a ManyToManyField to link to the Resource
model.
I would like the user to be able to enter the dates to and from, and
select the resource type. Then from these choices this would only show
those resources available that belong to the specific resource type.
I have defined an "is_available" met
The candidate object is attached to the request object by middleware.
class CandidateCheckMiddleware(object):
def process_view(self, request, view, args, kwargs):
candidate = request.user.is_authenticated() and \
Candidate.objects.filter(user=request.user)
if
On 12 Sty, 15:40, John Baker wrote:
> # later in code trying to delete
> candidate.delete()
>
> Any clues? (Django 1.0.2 final)
You need to provide how you fetch objects, I mean code before
cadidate.delete().
--~--~-~--~~~---~--~~
You
I cannot delete an object that has a foreign key to a user. The error
given is:
Cannot resolve keyword 'user' into field. Choices are: id, job, name
# the model
class Candidate(models.Model):
user = models.ForeignKey(User)
...
# later in code trying to delete
candidate.delete
It should be very useful to filter a select field in django admin when
selecting another field.
Somethin like:
fieldA = foreignKey(Country)
fieldB = foreignKey(State)
when user selects fieldA it should be shown only its states and not
all countries' states.
Is it possible? Someone wrote some
On Saturday, 22 November 2008 03:52:27 Jeff FW wrote:
> choices = Movie._meta.get_field('disk_type').choices
Ah, the 'Movie' in there was the missing voodoo. I was stuck on using an
instance; and yes, I prefer Movie dot choices 'global' idea.
Thanks for the various replies. I have more-or-l
You could define the CHOICES as a member of your model class, like so:
class Movie( Relic ):
CHOICES=((u'1','one'), (u'2',u'two'))
disk_type = models.CharField( 'Type', max_length=8,
choices=CHOICES)
Then, in your form:
class MovieForm( BasicRelicForm ):
disk_type = forms.CharField
On Friday, 21 November 2008 13:46:35 Daniel Roseman wrote:
> There is an alternative, though: instead of overriding the fields
> declaratively, you can define a formfield_callback function.
This seems interesting. I have searched the docs online
for 'formfield_callback' and get no useful
On Nov 21, 9:09 am, Donn <[EMAIL PROTECTED]> wrote:
> On Friday, 21 November 2008 08:06:32 urukay wrote:
>
> > easy way how to solve it is to put definition of your choices out of model
> > definition:
>
> Yeah, that's what I call a 'global', but is there no
u can use ModelForm and you don't have to write choices.
Don't know any other way. But I don't suppose there is other way, these two
"ways" can solve everything, I think.
Or maybe someone else would help
R.
Donn Ingle wrote:
>
>
> On Friday, 21 November 2008 08:06:32 ur
On Friday, 21 November 2008 08:06:32 urukay wrote:
> easy way how to solve it is to put definition of your choices out of model
> definition:
Yeah, that's what I call a 'global', but is there no way to get the choices
from the field in the model clas
easy way how to solve it is to put definition of your choices out of model
definition:
CHOICES=((u'1','one'), (u'2',u'two'))
class Movie( Relic ):
disk_type = models.CharField( 'Type', max_length=8, choices=CHOICES)
and then you can import CHOICES whereever you want and reuse it
from
myself. In the docs it says
"limit_choices_to has no effect when used on a ManyToManyField with an
intermediate table". So my choices list would have no effect if it
worked.
Maybe you could give me some general advice on how to approach what I
had mind.
Thanks - Silvan
On Nov 2
Hello,
In my model, I define the choices for a charfield. I make a ModelForm of that
model but I want my own widget for that field. How can I pass-through the
choices I defined in my model?
Some code:
class Movie( Relic ):
disk_type = models.CharField( 'Type', max_length=8, choices=((u'1
gt; class Project(models.Model):
> title = models.CharField(max_length=100)
> client = models.ManyToManyField(Contact, related_name='client',
> blank=True)
> collaborators = models.ManyToManyField(Contact,
> related_name='collaborators', blank
On Wed, 2008-11-19 at 09:42 -0800, Delta20 wrote:
> A model field may have a 'choices' option to which you assign an
> iterable object -- typically a list, but this can also be an iterable
> function. Is there a way to assign a class method/function rather than
> a module function?
lank=True)
collaborators = models.ManyToManyField(Contact,
related_name='collaborators', blank=True)
What I tried so far is to use a filter for constructing a choices list
within the “Project” model.
related_contacts = Contact.objects.filter
(projects_involved__title__starts_with=title)
This g
A model field may have a 'choices' option to which you assign an
iterable object -- typically a list, but this can also be an iterable
function. Is there a way to assign a class method/function rather than
a module function?
Here's what I'm trying to do: I have a model, "Ticket"
On Mon, Nov 17, 2008 at 9:56 PM, Canhua <[EMAIL PROTECTED]> wrote:
>
> 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
On Nov 18, 3:52 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> Usually you'd do this as a ManyToMany field. However I know you
> sometimes do want to do it in a custom model field - I've just posted
> my implementation at
> djangosnippets:http://www.djangosnippets.org/snippets/1200/
>
I've
On Nov 18, 3:52 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> Usually you'd do this as a ManyToMany field. However I know you
> sometimes do want to do it in a custom model field - I've just posted
> my implementation at
> djangosnippets:http://www.djangosnippets.org/snippets/1200/
>
I've
On Nov 18, 2:56 am, Canhua <[EMAIL PROTECTED]> wrote:
> 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
401 - 500 of 857 matches
Mail list logo