M
M
meowmere2020-12-30 16:53:32
Django
meowmere, 2020-12-30 16:53:32

Django Inline not outputting my qset, how to output?

there is a problem with Django Inline

admin.py

class ExtraPerfomerInline(admin.TabularInline):
model = ExtraPerfomer
extra = 0
show_change_link = True
readonly_fields = ('performer',)
fields = ('performer', 'sum',)

def performer(self, instance):
    return format_html_join(
        mark_safe('<br>'),
        '{}',
        ((line,) for line in instance.get_full_address()),
    ) or mark_safe("<span class='errors'>Error</span>")

def get_queryset(self, request):
    ...
    qs443 = super(ExtraPerfomerInline, self).get_queryset(request)
    qy = qs443.filter(pk=dad)
    return qy

I'm trying to display my collected qset,
uGOGW.png
but in fact Inline does not display anything.
PMFOM.png
The bottom line is that there is an m2m field, you need to display those performers that are in this field and display inline only the related field.
searches for what I need on request, but my qset does not output.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VkolV, 2020-12-31
@VkolV

Are the indents correct?
Where is the rest of the admin

def performer(self, instance):
    return mark_safe(Hello!)

Does the conclusion itself work?
From documentation
format_html_join(
    '\n', "<li>{} {}</li>",
    ((u.first_name, u.last_name) for u in users)
)

Why do you havemark_safe('<br>')?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question