inlines

Add row to inlines dynamically in django admin

I have the following defined: class AnswerChoiceInline(admin.TabularInline): model = AnswerChoice # extra = 0 class QuestionAdmin(admin.ModelAdmin): inlines = [AnswerChoiceInline] admin.site.register(Question, QuestionAdmin) Obviously I get the default extras setting (default is 3). Is there a way built into the admin ...

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

Hi, I've got a set of models that look like this: class Page(models.Model): title = models.CharField(max_length=255) class LinkSection(models.Model): page = models.ForeignKey(Page) title = models.CharField(max_length=255) class Link(models.Model): linksection = models.ForeignKey(LinkSection) text = models.CharFiel...

wpf: checking how many components are inside of a Span?

I have WPF Span that is used as a source to a TextBlock. I am doing some tests and it would be very helpful to know in code how many of which type of component is inside of the Span. For example, at one point I insert a new Bold() into the span's inlines. How would I check that there is exactly one Bold component contained inside of the...

UserProfile StackedInLine/TabularInLine redesigned

Hello everyone and thanks for reading. I have a simple problem that I want to get rid of and I have not seen examples where this is achieved yet although searching around the net for quite a while. I recently extended with UserProfile so my admin.py looks like this: from django.contrib import admin from django.contrib.auth.models impo...

Data binding the TextBlock.Inlines

My WPF App receives a stream of messages from a backend service that I need to display in the UI. These messages vary widely and I want to have different visual layout (string formats, colors, Fonts, icons, whatever etc.) for each message. I was hoping to just be able to create an inline (Run, TextBlock, Italic etc) for each message ...

Django admin different inlines for change and add view

Hi, I need separate views for add and change page. In add page I'd like to exclude some fields from inline formset. I've prepared two TabularInline classes, one of them contains property 'exclude'. I tried to use them as follows: class BoxAdmin(admin.ModelAdmin): def change_view(self, request, obj_id): self.inlines=[ItemCha...

How to deal with multiple sub-type of one super-type in Django admin

What would be the best solution for adding/editing multiple sub-types. E.g a super-type class Contact with sub-type class Client and sub-type class Supplier. The way shown here works, but when you edit a Contact you get both inlines i.e. sub-type Client AND sub-type Supplier. So even if you only want to add a Client you also get the fi...

group inlines in django admin

Hi I have a two models, Model1 and Model2. Model2 has a FK to Model1 and FK to iteself. In the admin I show Model2 as inlines in Model1 change_form. I want to modify the way the inlines are shown in the admin. I need to group all the instances that have the same parent_model2 and display them as a readonly field with a string of 'child...

Django Inlines user permissions + view only - permissions issues

I'm not sure if this is a bug or I'm just missing something (although I have already parsed the documentation about inlines), but: Let's say I have a model A. Model A is an inline of model B. User U has full access to model B, but only change permissions to model A (so, no add, nor delete). However, when editing model B, user U can sti...

Inlines in Django Admin

I have two models, Order and UserProfile. Each Order has a ForeignKey to UserProfile, to associate it with that user. On the django admin page for each Order, I'd like to display the UserProfile associated with it, for easy processing of information. I have tried inlines: class UserInline(admin.TabularInline): model = UserProfile...

Highlight Search TextBlock

My goal is to create a custom TextBlock control that has a new dependency property, SearchText. This property will contain a regular expression. All occurrences of this regular expression in the text of the TextBlock will be highlighted using a custom style (another DP). My current implementation involves clearing all of the Inline obje...