Tell me how to implement the following: when filling the first field in the form in the second field, the data is automatically substituted depending on the first one. Suppose we select the network 192.168.1.1/24 in the first field, and the free IP address 192.168.1.111 substituted in the second field. All this is done on Django.

    1 answer 1

    If you want this to be done instantly on the page, then only javascript. You hang up the handler on the first field, as soon as its contents match the required template, fill the second field with the necessary text.

    I understand that a free ip must be selected on the basis of data on ip employed in the database, in this case it will be necessary to make an AJAX request to the server. In the django-code, you need to make a representation that will process the received data (network 192.168.1.1/24) and will issue the required ip based on the logic of your application. This view is associated with a url in urlconf, to which you send an AJAX request, for example, using jQuery tools

    • I am already working in this direction, thank you! - avdoshkin