# How to display a model method in a formset?

**URL:** <https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736>\
**Category:** Forms & APIs\
**Created:** [March 23, 2023, 9:44am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736 "2023-03-23T09:44:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 23, 2023, 9:44am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/1 "2023-03-23T09:44:32Z")

</div>

**models.py**

```auto
class Business(models.Model):
    name = models.CharField('Affaire',max_length=200,)
    customer = models.ForeignKey(Customer,on_delete=models.CASCADE,verbose_name='Client',
        null = True,blank = True)
    contact = models.ForeignKey(Contact,on_delete=models.SET_NULL, null=True)
    account_exec = models.ForeignKey(Account_exec,on_delete=models.SET_NULL, null=True, verbose_name='Chargé d\'affaires')
    amount = models.DecimalField('Montant',max_digits=9, decimal_places=2)
    ponderation = models.ForeignKey(BusinessStatus, on_delete=models.RESTRICT)

    @property
    def amount_pondered(self):
        status = BusinessStatus.objects.get(pk=self.ponderation_id)
        taux = status.weight
        amount = self.amount * taux / 100
        return amount

```

forms.py

```auto
class BusinessForm(ModelForm):
    class Meta:
        model = Business
        fields = ['name', 'customer', 'account_exec', 'amount','ponderation','amount_pondered','contract_type']
        #widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput,'contract_type': forms.RadioSelect()}
        widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput}
  

```

Having “amount\_pondered” in the fields generates an error: “Unknown field(s) (amount\_pondered) specified for Business”. I can get it, as amount\_pondered is not to be entered by the user but is computed).

How can I display this “amount\_pondered” field when I’m using a BusinessFormset form an inlineformset\_factory?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 23, 2023, 11:07am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/2 "2023-03-23T11:07:40Z")

</div>

Create that field as a field in the form, not as a reference to a Model field. Set the value of that field in the ` __init__ ` method of the form. You’ll probably also want to mark that field as disabled.

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 23, 2023, 1:54pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/3 "2023-03-23T13:54:23Z")

</div>

Could you give me the code for the init of this field "amount\_pondered " as it is defined in the model class?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 23, 2023, 2:16pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/4 "2023-03-23T14:16:52Z")

</div>

Actually, I’m going to correct my previous reply. It’s not necessary to define code in the ` __init__ ` method for this.

Reviewing [the docs for the `initial` attribute of a field](https://docs.djangoproject.com/en/4.1/ref/forms/fields/#django.forms.Field.initial) reminds me that you can pass a callable as that attribute. Review the last example in that section of the docs.

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 23, 2023, 3:18pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/5 "2023-03-23T15:18:17Z")

</div>

I still don’t see how to initialize the value of amount\_pondered…

```auto
class BusinessForm(ModelForm):
    amount_pondered = forms.CharField(disabled=True)
    amount_pondered = ???
    class Meta:
        model = Business
        fields = ['name', 'customer', 'account_exec', 'amount','ponderation','contract_type']
        #widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput,'contract_type': forms.RadioSelect()}
        widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput}

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 23, 2023, 4:10pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/6 "2023-03-23T16:10:26Z")

</div>

In the example in the referenced doc, how are they setting an initial value for `day`?

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 23, 2023, 5:16pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/7 "2023-03-23T17:16:24Z")

</div>

in the example: day = forms.DateField(initial=datetime.date.today). That’s pretty straight forward.  
But in my case, as amount\_pondered is defined as follows in the model, I don’t see how to do.

```auto
    def amount_pondered(self):
        status = BusinessStatus.objects.get(pk=self.ponderation_id)
        taux = status.weight
        amount = self.amount * taux / 100
        return amount

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 23, 2023, 5:26pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/8 "2023-03-23T17:26:46Z")

</div>

The import statement prior to this imports `datetime`.

If you’re not familiar with it, `datetime.date.today` is the name of a function to return the current day.

Specifically:

```plaintext
day = forms.DateField(initial=datetime.date.today)
                                            ^^^^^
# Name of the function to call to get the initial value for this field.

```

What’s the name of the function that you want to call to initialize your field? What do you think then your field definition might look like?

If you know you’re always going to be provided an instance of `Business` in the creation of the formset, you can use the name of that function based on that instance.

If you have a situation where you’re not providing an instance to the formset, then you would need to create a different function in your form to call your function if the instance is provided, and to return a zero value otherwise.

I can’t be more specific without seeing the views and formsets involved.

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 24, 2023, 9:08am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/9 "2023-03-24T09:08:14Z")

</div>

Let me try to explain the context

Models.py

```auto
class BusinessStatus(models.Model):
    label = models.CharField('Libellé',max_length=50)
    weight = models.IntegerField('Taux', default=10)
    final = models.BooleanField(default=False)
    
    def text(self):
        return self.label + ' (' + str(self.weight) + '%)'

    class Meta:
        ordering = ['weight']
        verbose_name = 'Etat'

    def __str__ (self):
        """Cette retourne une chaîne de caractère pour identifier l'instance de la classe d'objet."""
        return self.label

class Business(models.Model):
    name = models.CharField('Affaire',max_length=200,)
    customer = models.ForeignKey(Customer,on_delete=models.CASCADE,verbose_name='Client',
        null = True,blank = True)
    contact = models.ForeignKey(Contact,on_delete=models.SET_NULL, null=True)
    account_exec = models.ForeignKey(Account_exec,on_delete=models.SET_NULL, null=True, verbose_name='Chargé d\'affaires')
    amount = models.DecimalField('Montant',max_digits=9, decimal_places=2)
    ponderation = models.ForeignKey(BusinessStatus, on_delete=models.RESTRICT)

    @property
    def amount_pondered(self):
        status = BusinessStatus.objects.get(pk=self.ponderation_id)
        taux = status.weight
        amount = self.amount * taux / 100
        return amount
    
    def status(self):
        return BusinessStatus.objects.get(pk=self.ponderation_id).text()
        
    def weight(self):
        return BusinessStatus.objects.get(pk=self.ponderation_id).weight        

    def __str__ (self):
        """String for representing the Model object (in Admin site etc.)"""
        return self.name
    
    def get_absolute_url(self):
        return reverse('customer_detail_form', kwarg={'pk':self.pk})
    
    class Meta:
        ordering = ['ponderation','amount']
        verbose_name = 'Affaire'

```

The view which allows to display and modifiy all the businesses of a given customer

```auto
class CustomerUpdateView(UpdateView):
    template_name = 'gestcom/customer_update_form.html'
    model = Customer
    fields = ' __all__'
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        customer = get_object_or_404(Customer, pk=self.kwargs['pk']) 
        context['customer_name']=customer.name 
        context['customer_form'] = CustomerForm(instance = customer)
        BusinessFormSet = inlineformset_factory(Customer,Business,can_delete=True,extra=1, form = BusinessForm)
        business_formset = BusinessFormSet(instance=customer)
        context['business_formset'] = business_formset
        return context

    def post(self, request, *args, **kwargs):
        # récupération de la clé primaire depuis l'url
        pk = self.kwargs['pk'] 
        # récupération de l'enregistrement Theme à partir de pk
        customer = get_object_or_404(Customer, pk=pk)      
        # création des forms
        customer_form = CustomerForm(instance=customer, data=request.POST)
        BusinessFormSet = inlineformset_factory(Customer, Business, can_delete=True, extra=1, form = BusinessForm)
        business_formset = BusinessFormSet(instance=customer, data= request.POST)      
        if 'update' in request.POST:
            if customer_form.is_valid():
                if business_formset.is_valid():
 messages.success(request,'Les données ont été mises à jour')
                            customer_form.save()
                            business_formset.save()
                else:
                    messages.warning(request, request.POST)
                    messages.warning(request, 'Données affaires invalides: ' + str(business_formset.errors))
            else:
                messages.warning(request, request.POST)
                messages.warning(request, 'Données de client invalides:' + str(customer_form.errors))
        return HttpResponseRedirect(reverse('customer_update_form', args=(customer.id,)))      

```

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 24, 2023, 9:29am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/10 "2023-03-24T09:29:01Z")

</div>

Sorry the previous message is uncomplete.  
Here again,

Models.py:

```auto
class BusinessStatus(models.Model):
    label = models.CharField('Libellé',max_length=50)
    weight = models.IntegerField('Taux', default=10)
    final = models.BooleanField(default=False)
    
    def text(self):
        return self.label + ' (' + str(self.weight) + '%)'

    class Meta:
        ordering = ['weight']
        verbose_name = 'Etat'

    def __str__ (self):
        """Cette retourne une chaîne de caractère pour identifier l'instance de la classe d'objet."""
        return self.label

class Business(models.Model):
    name = models.CharField('Affaire',max_length=200,)
    customer = models.ForeignKey(Customer,on_delete=models.CASCADE,verbose_name='Client',
        null = True,blank = True)
    contact = models.ForeignKey(Contact,on_delete=models.SET_NULL, null=True)
    account_exec = models.ForeignKey(Account_exec,on_delete=models.SET_NULL, null=True, verbose_name='Chargé d\'affaires')
    amount = models.DecimalField('Montant',max_digits=9, decimal_places=2)
    ponderation = models.ForeignKey(BusinessStatus, on_delete=models.RESTRICT)

    @property
    def amount_pondered(self):
        status = BusinessStatus.objects.get(pk=self.ponderation_id)
        taux = status.weight
        amount = self.amount * taux / 100
        return amount
    
    def status(self):
        return BusinessStatus.objects.get(pk=self.ponderation_id).text()
        
    def weight(self):
        return BusinessStatus.objects.get(pk=self.ponderation_id).weight        

    def __str__ (self):
        """String for representing the Model object (in Admin site etc.)"""
        return self.name
    
    def get_absolute_url(self):
        return reverse('customer_detail_form', kwarg={'pk':self.pk})
    
    class Meta:
        ordering = ['ponderation','amount']
        verbose_name = 'Affaire'

```

The forms which are involved. No way to put amount\_pondered in the BusinessForm model related fields. So I have added it with no reference to the model and set it to “disabled”, as you suggested. But I don’t know how to initialize it to the right value, meaning:  
For a given business, the field “amount\_pondered” which is based on fields on the current instance, amount\_poundered = amount \* taux / 100, where  
taux = BusinessStatus.objects.get(pk=self.ponderation\_id).weight

```auto
class CustomerForm(ModelForm):
    name = forms.CharField(
        widget=forms.TextInput(attrs={'autofocus': True}))    

    class Meta:
        model= Customer
        fields = ' __all__'
        widgets = {'creation_date': DatePickerInput}   

class BusinessForm(ModelForm):
    amount_pondered = forms.CharField(disabled=True)
    class Meta:
        model = Business
        fields = ['name', 'customer', 'account_exec', 'amount','ponderation','contract_type']
        #widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput,'contract_type': forms.RadioSelect()}
        widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput}

```

View which allows to display, update, create and delete businesses for a given customer.

```auto
class CustomerUpdateView(UpdateView):
    template_name = 'gestcom/customer_update_form.html'
    model = Customer
    fields = ' __all__'
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        customer = get_object_or_404(Customer, pk=self.kwargs['pk']) 
        context['customer_name']=customer.name 
        context['customer_form'] = CustomerForm(instance = customer)
        BusinessFormSet = inlineformset_factory(Customer,Business,can_delete=True,extra=1, form = BusinessForm)
        business_formset = BusinessFormSet(instance=customer)
        context['business_formset'] = business_formset  
        return context

    def post(self, request, *args, **kwargs):
        # récupération de la clé primaire depuis l'url
        pk = self.kwargs['pk'] 
        # récupération de l'enregistrement Theme à partir de pk
        customer = get_object_or_404(Customer, pk=pk)      
        # création des forms
        customer_form = CustomerForm(instance=customer, data=request.POST)
        BusinessFormSet = inlineformset_factory(Customer, Business, can_delete=True, extra=1, form = BusinessForm)
        business_formset = BusinessFormSet(instance=customer, data= request.POST)      
        if 'update' in request.POST:
            if customer_form.is_valid():
                if business_formset.is_valid():
                            messages.success(request,'Les données ont été mises à jour')
                            customer_form.save()
                            business_formset.save()
                            contact_formset.save()
                            address_formset.save()                   
                else:
                    messages.warning(request, request.POST)
                    messages.warning(request, 'Données affaires invalides: ' + str(business_formset.errors))
            else:
                messages.warning(request, request.POST)
                messages.warning(request, 'Données de client invalides:' + str(customer_form.errors))
        return HttpResponseRedirect(reverse('customer_update_form', args=(customer.id,)))      

```

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 24, 2023, 10:21am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/11 "2023-03-24T10:21:55Z")

</div>

To make it short, I don’t know how to pass the instance to my callable.  
In the following trial, 70 is well displayed. But how do I pass the right arguments to init\_amount\_pondered to make it work as I want? I guess I’m missing something big ☹

```auto
class BusinessForm(ModelForm):
    def init_amount_pondered():
        return 70
    
    amount_pondered = forms.CharField(disabled=True, initial=init_amount_pondered())
    class Meta:
        model = Business
        fields = ['name', 'customer', 'account_exec', 'amount','ponderation','contract_type']
        #widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput,'contract_type': forms.RadioSelect()}
        widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput}

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 24, 2023, 12:03pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/12 "2023-03-24T12:03:50Z")

</div>

We’re close, and heading in the right direction.

First a couple things to clean up:

- You have your function defined as:

> [@RichardWoj](#):
>
> `def init_amount_pondered():`

This is the definition of a method inside a class. As a result, it will be passed the instance of the class as the first parameter. By convention, this parameter is named `self`. That means the definition of this function should be:  
`def init_amount_pondered(self):`

- The `initial` parameter should be passed a callable, and not the output of the function.

Notice the example above regarding `today`, they aren’t passing `today()`, they’re passing `today`. Also, your reference should be to the function for the current instance, also referred to by `self`. As a result, the parameter should be:

`initial=self.init_amount_pondered`

(If this doesn’t make any sense to you, I suggest you review the docs at [https://docs.python.org/3/tutorial/classes.html.](https://docs.python.org/3/tutorial/classes.html.))

- Do yourself a favor here and remove the `@property` decorator on your `amount_pndered` function. There are almost no circumstances where it’s required and may actually make things more difficult here.

Now, what happens in a modelformset is that a form is generated for each instance of the model in the formset. A ModelForm has access to the instance of the model as `self.instance`.

This means that you should be able access the amount\_pondered function in the form as `self.instance.amount_pondered`

e.g. `return self.instance.amount_pondered()`.

If you are _only ever_ going to create this formset for pre-existing instances ( **never** having a blank form), you could reference this function directly in the `initial` parameter of the field:  
`initial = self.instance.amount_pondered`  
But this would throw an error if you ever try to render a blank form (no pre-existing instance).

So I would suggest that you put this in the `init_amount_pondered` function, guarded by an `if` statement, e.g. `if self.instance:`. The else clause for that if can return whatever value you’d like.

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 24, 2023, 5:44pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/13 "2023-03-24T17:44:03Z")

</div>

in the following, in the “initial=self.init\_amount\_pondered”, VS Code raises an error on “self”, as a variable not defined… There is still something I’m missing…

```auto
class BusinessForm(ModelForm):
    def init_amount_pondered(self):
        if self.instance:
            status = BusinessStatus.objects.get(pk=self.ponderation_id)
            taux = status.weight
            taux = 30
            amount = self.amount * taux / 100
        else:
            amount = 0
        return amount
    
    amount_pondered = forms.CharField(disabled=True, initial=self.init_amount_pondered)
    class Meta:
        model = Business
        fields = ['name', 'customer', 'account_exec', 'amount','ponderation','contract_type']
        #widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput,'contract_type': forms.RadioSelect()}
        widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput}

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 24, 2023, 7:47pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/14 "2023-03-24T19:47:55Z")

</div>

That’s probably just a VSCode issue. Is it otherwise working?

It may not, in which case you would need to make a couple changes, but I’d try this first.

Also , you moved the functionality from the model to your form, which is unnecessary.

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 25, 2023, 9:10am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/15 "2023-03-25T09:10:03Z")

</div>

Hi Ken,

Unfortunately,it’s not a VS Code issue, Python shows the same problem

forms.py", line 73, in BusinessForm  
amount\_pondered = forms.CharField(disabled=True, initial=self.init\_amount\_pondered)  
^^^^  
NameError: name ‘self’ is not defined

Any idea of the changes to make?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 25, 2023, 11:56am UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/16 "2023-03-25T11:56:05Z")

</div>

I sincerely want to apologize for chasing you down a wrong path. Apparently _this_ is a lesson I need to be reminded of periodically - I probably make this mistake about every year or so.

I should have stayed with my original thought.

> [@KenWhitesell](#):
>
> Create that field as a field in the form, not as a reference to a Model field. Set the value of that field in the ` __init__ ` method of the form. You’ll probably also want to mark that field as disabled.

This was my first answer - and the direction I should have stayed with. I shouldn’t have second-guessed myself.

Anyway, what you’re looking for should probably look something like this:

```auto
class BusinessForm(ModelForm):
    def init_amount_pondered(self):
        if self.instance.pk:
            amount = self.instance.amount_pondered()
        else:
            amount = 0
        return amount
    
    amount_pondered = forms.CharField(disabled=True)

    def __init__ (self, *args, **kwargs):
        super(). __init__ (*args, **kwargs)
        self.fields['amount_pondered'].initial = self.init_amount_pondered()

    class Meta:
        model = Business
        fields = ['name', 'customer', 'account_exec', 'amount','ponderation','contract_type']
        widgets = {'creation_date': DatePickerInput,'signature_date': DatePickerInput}

```

Again, I’m _really_ sorry for this.

---

<div class="post-metadata">

**Author:** ![RichardWoj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/richardwoj/32/12824_2.png) [@RichardWoj](https://forum.djangoproject.com/u/RichardWoj)\
**Post date:** [March 25, 2023, 4:12pm UTC](https://forum.djangoproject.com/t/how-to-display-a-model-method-in-a-formset/19736/17 "2023-03-25T16:12:02Z")

</div>

Hello Ken

Yes! it works!!!  
Thank you very much, Y’ve been very, very helpfull.  
And don’t be sorry, our chat has allowed me to better understand what’s going on behind the scene.

Thanks again for being so responsive and patient!

Richard
