Django admin – inline inlines (or, three model editing at once)

You need to create a custom form and template for the LinkSectionInline. Something like this should work for the form: LinkFormset = forms.modelformset_factory(Link) class LinkSectionForm(forms.ModelForm): def __init__(self, **kwargs): super(LinkSectionForm, self).__init__(**kwargs) self.link_formset = LinkFormset(instance=self.instance, data=self.data or None, prefix=self.prefix) def is_valid(self): return (super(LinkSectionForm, self).is_valid() and self.link_formset.is_valid()) def save(self, commit=True): # Supporting commit=False is another can of worms. … Read more

Data binding the TextBlock.Inlines

You could add a Dependency Property to a TextBlock Subclass public class BindableTextBlock : TextBlock { public ObservableCollection<Inline> InlineList { get { return (ObservableCollection<Inline>)GetValue(InlineListProperty); } set { SetValue(InlineListProperty, value); } } public static readonly DependencyProperty InlineListProperty = DependencyProperty.Register(“InlineList”,typeof(ObservableCollection<Inline>), typeof(BindableTextBlock), new UIPropertyMetadata(null, OnPropertyChanged)); private static void OnPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { BindableTextBlock textBlock = sender as … Read more

tech