Django use variable from view or url in forms.py
<p>It's possible to use variable inside forms.py? I'm using field with choices based on queryset from Platform model. My url and view contain this id but I don't know how to give this to forms.py to my queryset.</p>

<p><strong>forms.py:</strong></p>

<pre><code>class OrderCreateForm(forms.ModelForm):
    platform = forms.CharField(choices=Platform.objects.filter(client_id=variable_from_view_or_url).values_list('id', 'name').order_by('id'))

    class Meta:
        model = Order
        fields = ('price', 'deadline', 'finished', 'client', 'platform')
</code></pre>

<p><strong>view.py:</strong></p>

<pre><code>@user_passes_test(lambda u: u.is_staff, login_url='/account/login/')
def order_create(request, request_client_id):
    dict = {}

    dict['form_order'] = OrderCreateForm()
    return render(request, 'panel/order/form.html', dict)
</code></pre>