As an interesting aside, the following portion of the class
LabelIngredients *does* seem to have an effect:
class Meta:
verbose_name = 'Label Ingredient'
ordering = [ 'order' ]
So the ordering is at least possible!
--~--~-~--~~~-
Yep, but that doesn't work for intermediary tables, because the field
isn't BakedGoods.ingredient, it's LabelIngredients.ingredient_id. Or if
it does work, it has to reference a different table somehow.
I tried adding all that to the intermediary table, but nothing seemed
to have any effect.
la
Here's the code used in the Tutorial example for collapsing in the admin
interface:
class Admin:
fields = (
(None, {'fields': ('question',)}),
('Date information', {'fields': ('pub_date',), 'classes': 'collapse'}),
)
http://www.djangoproject.com/documentation/tutorial2/
Fixed, but not understood...
Another post suggested that the order of the class declaration inside
models.py was important, so I changed mine to reflect that. Order
became Ingredients, BakedGoods, LabelIngredients.
Also based on reading that post, I changed the LabelIngredients class
to:
Nope, you understood just fine. I was trying to order it in the M2Mi
model.
Thanks for the assist!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-u
Forgive me if I'm mis-understanding you here, but to sort the select box
of your ingredients you can add an 'ordering' to your ingredients model,
like so...
class Ingredient(models.Model)
name = models.CharField()
...
class Meta:
ordering = ['name']
Which will sort the Ingre
Actually, for a further while I'm at it, is there a way to add class:
collapse to the M2M field?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-user
I have models for baked goods and their ingredients, imaginatively
named BakedGoods and Ingredients. I need to save the order of the
ingredients for purposes of making informative labels. So, there's a
third model, LabelIngredients, that is described by:
baked_good = models.ForeignKey( Ba
8 matches
Mail list logo