How to redefine a display form field so it shows a content with filtring?

I have some models classes. And some classes have bounding fields with another class. Each class have the field - author. I whould like that for each user the form bounding field shows only those data which was created these authors.

For example:
class “TypeJob” has field “author”.
User Jhon created a TypJob - “Painting”.
User Alex created a TypJob - “Cleaning”.
Class “Order” has bounding field - “name_typ_job”
When Jhon whould like create an order, he opens the form and click “name type job” field, he sees both type job: painting and cleaning.
I whould like that he sees and could choose only “painting”. Because he is it author.

Django 3

In your form you would define a queryset for the field that would filter the selections based upon your criteria.

See the queryset option in the ModelChoiceField.

Thank you for your answer!
But I don’t understand what exactly I should do. Please could you help me?
I wrote that

class OrderTestForm(forms.ModelForm):
    class Meta:
        model = Order
    name_job = forms.ModelChoiceField(queryset=None)
    qs = TypJob.objects.filter(
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['name_job'].queryset = qs

But I have

name ‘user’ is not defined

name ‘author__id’ is not defined

I will also need to see the view that is using this form.

The form itself isn’t going to have all the information you need. You will need to pass the user object from the request object in the view into the form when you’re creating your instance of that form.

But in general, you’re on the right track.
Your view is, in part, going to look like this (if you’re using a function-based view instead of a class-based view):

def my_view(request):
   form = MyForm(current_user=request.user)

Then your form would (in part) look something like this:

class MyForm(ModelForm):
    class Meta:
        model = MyModel
        fields = ['a_field', 'another_field']

    a_field = forms.ModelChoiceField(queryset=None)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['a_field'].queryset = MyOtherModel.objects.filter(user=kwargs['current_user'])

class OrderNewBigPrintView(LoginRequiredMixin, CustomSuccessMessageMixin, CreateView):
    model = Order
    template_name = 'new_order_bp.html'
    form_class = OrderForm
    success_url = reverse_lazy('orders')
    success_msg = 'Ok'
    def post(self, request, *args, **kwargs):
        form = self.get_form(current_user=request.user)

class OrderForm(forms.ModelForm):
    class Meta:
        model = Order
        fields = '__all__'
    name_job = forms.ModelMultipleChoiceField(queryset=None)
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        qs = TypJob.objects.filter(user=kwargs['current_user'])
        self.fields['name_job'].queryset = qs

I have error
‘NoneType’ object has no attribute ‘_prefetch_related_lookups’

I think I may need to see your models. Is ‘name_job’ one of the fields in your Order model?

from django.db import models
from django.contrib.auth.models import User
from phonenumber_field.modelfields import PhoneNumberField
import requests

class Customer(models.Model):
	'''Клиент и данные клиента'''
	author = models.ForeignKey(User, on_delete = models.CASCADE, verbose_name='Автор клиента', null=True)
	name = models.CharField('название', max_length=200)
	name_full = models.CharField('Ф.И.О.', max_length=250)
	tel_number = PhoneNumberField(verbose_name ='номер телефона', blank=True, null=True)
	email = models.EmailField('почта', max_length=100, blank=True, null=True)

class Order(models.Model):
	author = models.ForeignKey(User, on_delete = models.CASCADE, verbose_name='Автор заказа', blank=True, null=True)
	number_order = models.CharField('номер заказа', max_length=100)
	date_create = models.DateTimeField(auto_now=True)
	name = models.ForeignKey(Customer, on_delete = models.CASCADE, verbose_name='Заказчик', null=True)
	name_order = models.CharField('название', max_length=200)

What’s the get_form function in your view doing? Is it passing the current_user through to the OrderForm initializer?

Thank you for advice.
I have resolved this issue.

class OrderForm(forms.ModelForm):
    class Meta:
        model = Order
        fields = '__all__'
    def __init__(self, *args, **kwargs):
        # get 'user' param from kwargs
        user = kwargs.pop('user', None)
        super().__init__(*args, **kwargs)
        # set class attrs  
        for field in self.fields.values():
             field.widget.attrs['class'] = 'form-control'
        # set 'name_job' queryset
        self.fields['name_job'].queryset = TypJob.objects.filter(

class OrderCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, CreateView):
    model = Order
    template_name = 'new_order.html'
    form_class = OrderForm
    success_url = reverse_lazy('orders')
    success_msg = 'Ok'
        # this method will pass 'user' as param in kwargs to form __init__()
    def get_form_kwargs(self):
        kwargs = super(OrderCreateView, self).get_form_kwargs()
        kwargs['user'] =  self.request.user
        return kwargs