We'll I created a new function called r_col. That returns a value to
my sandp field from within the Style Class. However, I'm not sure how
to pass it the current value of the collection field from within the
Style Class. Below are my model files:
class Choice(models.Model):
choice =
Anybody?
On Aug 1, 2:49 pm, Greg <[EMAIL PROTECTED]> wrote:
> Ok..does anybody know what's wrong with this attempt at trying to get
> the 'limit-choices_to' to work?
>
> class Choice(models.Model):
> choice = models.ForeignKey(Collection, edit_inline=models.TABULAR,
> num_in_admin=5)
>
Ok..does anybody know what's wrong with this attempt at trying to get
the 'limit-choices_to' to work?
class Choice(models.Model):
choice = models.ForeignKey(Collection, edit_inline=models.TABULAR,
num_in_admin=5)
size = models.ForeignKey(Size, core=True)
price =
We'll I kinda got it to work. I added the following
(limit_choice_to):
sandp = models.ManyToManyField(Choice, limit_choices_to = {'choice':
2})
///
That works fine. However, I obviously want to take out the '2'. I
tried the following but it does not seem to work:
sandp =
> Is there anyway that I can have the 'sandp' Field only
> show choices that are tied to that collection?
Try using the limit_choices_to argument to ManyToManyField:
http://www.djangoproject.com/documentation/model-api/#many-to-many-relationships
Hope this helps,
Will.
> Is there anyway that I can have the 'sandp' Field only
> show choices that are tied to that collection?
This is the purpose of making ForeignKeys I guess.
You may try:
mycollection = Collection.objects.all()[0]
related_choices = Choice.objects.filter(choice=mycollection)
I think that
6 matches
Mail list logo