Django inline admin problems
I'm trying to do such a thing: I have two models, connected via Foreign Key, and every instance of first model needs to be linked with exactly 4 instances of second (I use InlineAdmin to create them at the same time using extra=4 and max_num=4).
There are two problems:
1 - I need each of four models to has it's own default read only value for one of it's fields, this value needs to be selected from the field's choices option. But I need them to be read only (I know about readonly_fields, but it's useless for that. Javascript don't seems to be a good solution...
2 - I need to specify default values for some field for all four models at the same time editing only one field. I'm thinking of two possible solutions: javascript or开发者_JS百科 one additional, "fifth" model with all hidden fields except the one I need so I can override save() to use it's values for other models and delete it.
But which is the right way?
Try this documentation, it might help:
https://docs.djangoproject.com/en/1.5/ref/models/fields/#editable
精彩评论