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:
<code>
baked_good = models.ForeignKey( BakedGoods , edit_inline = True )
ingredient = models.ForeignKey( Ingredients )
# the extra bit
order = models.PositiveIntegerField( maxlength = 10 ) # 10!?
</code>
Now, this all works fine when I use admin to enter a new baked good. I
can enter up to three ingredients before I have to save and continue
editing to add further ingredients. When I save and continue editing
after adding the fourth ingredient, the first three ingredients vanish.
>From the form, from the database, whoosh. If I then edit the baked good
without adding another ingredient, I get this error:
Exception Type: OperationalError
Exception Value: (1048, "Column 'ingredient_id' cannot be null")
Exception
Location: /usr/lib/python2.4/site-packages/MySQLdb/connections.py in
defaulterrorhandler, line 33
It looks like Django is, for some reason, actively dropping any
ingredient that wasn't just added.
While I'm deep in the midst of this problem, I can't tell from the docs
how to sort the select box for ingredients and that would be very handy
to know as well.
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---