Jak wywołać metodę modelu w zestawach pól ModelAdmin django?

Chcę wyświetlić osadzoną mapę na formularzu administratora, gdy dane już istnieją w db. Mam następujący kod:

models.py

class Address(models.Model):
    address = models.CharField()

    def address_2_html(self):
        if self.address:
            # Return html for an embedded map using the entered address.
            return embedded_map_html
        else:
            return ''
    address_2_html.allow_tags = True

admin.py

class AddressAdmin(admin.ModelAdmin):
    fieldsets = [(label, {'fields': ['address','address_2_html']}),]

To nie działa. Dostaję błąd:

'AddressAdmin.fieldsets[1][1]['fields']' refers to field 'address_2_html' that is missing from the form.

Inną rzeczą, którą próbowałem, było użycie opcji 'description' dla 'fieldsets', jednak 'address_2_html' nie jest dostępny w ramach AddressAdmin. Udało mi się osadzić mapę statyczną za pomocą „opisu”, który był fajny, ale nie wystarczająco chłodny.

questionAnswers(2)

yourAnswerToTheQuestion