Can you please tell me how to pass data from the site form to the Python function?
I can not figure out the algorithm of the process itself, what is it going to? In the information that I found on the Internet, they create a form in the models, then it is generated on the site and already becomes tied to the models file.What if the form has already been created on the site manually, for example:

<form method="GET" action="/admi">
			<label for="your_name">Your name:</label>
			<input id="your_name" type="text" name="object" value=""><! - In"value =", you can enter a default value - ->
			<input type="submit" value="OK">
		</form>


How to force to transfer its data to the python function?
  • Why form created manually? – Disney's88 Oct 4 '18 at 10:32
  • Disney's88, By the fact that I understand more or less HTML and CSS, and Django is not very :( It will be easier for me to understand :( – Thoughtful Toucan Oct 4 '18 at 10:38
  • Thoughtful Toucan, no, so much more difficult, much more

    Understand how to make forms in django - there is nothing complicated
    – Disney's88 Oct 4 '18 at 10:39
  • Well, I will try this :) In principle, I already understood that it scared me. I thought if they are generated automatically, how will I apply styles to them? And it turns out that the form tag itself is not generated, you manually prescribe it, you can add a style to it, that is, that’s what happens :) Or is it something I don’t understand? – Thoughtful Toucan Oct 4 '18 at 10:56
  • Disney's88, I’ve seen the question of forms many times as old-timers drown behind django forms, but they didn’t seem to me to be very convenient, if you need something not standard, then django forms start to interfere, not help. So what is the power of a brother?
    P.S A form that does not fit under the django form will sooner or later appear if the project is not a business card site.
    – Elated Emu Oct 4 '18 at 13:09
  • Elated Emu, Thoughtful Toucan,
    You should use not just forms, but django-crispy-forms. And nothing will not interfere. Writing forms by hand is an anachronism and shooting yourself in the foot. The DRY principle is violated, since the form is essentially described in two places, and sooner or later two different representations get out of sync, leading to unexpected and strange glitches (a commonplace example, the list of options in select will change).

    I would like to start the author with a thoughtful and attentive reading of the Django tutorial from the official site. You cannot start writing, without reading at least this tutorial. The development of copy-paste from sites with answers is bad for you and for the community as a whole.
    – Funny25 Oct 4 '18 at 13:26
  • Elated Emu,

    If you read the tutorial and the code of the forms, it will be clear that they are suitable for all cases
    No exceptions
    – Disney's88 Oct 4 '18 at 13:55
  • Elated Emu, For now, I agree with you, although this is most likely due to the lack of experience with DJango. In my case, the situation is complicated by the fact that I use two databases...
    Funny25, It may be worthwhile for someone to study the theory first, but definitely not for me. From the fact that I read the whole tutorial, there will be no sense, without practice. To do something beautiful, you must first learn how to do it ugly... Regarding"copying", for most of my questions (unfortunately this is an exception), I ask for a link to the information to read. What is criminal for the community? After all, even experienced programmers consult each other when something is forgotten...
    – Thoughtful Toucan Oct 10 '18 at 08:24
  • Thoughtful Toucan, I just have a team leader, an opponent of django forms, he has enough experience. I wanted to listen to other experienced people on this topic, but something went wrong. – Elated Emu Oct 10 '18 at 09:53
  • Thoughtful Toucan, tutorial is the absolute minimum. Nobody talks about the years of studying the theory, but you have not finished reading the very basics of the basics, you are already trying to do something using the copy-paste method. This is definitely the wrong way. According to your description, your Timlid has not yet grown to the Timlid. Because all advisors write without forms or roll them into HTML manually, they simply didn’t go through the pile of rakes to understand how vicious the practice is. Sometimes it saves 10 minutes of work, in order to take away the hours for debugging and support. – Funny25 Oct 10 '18 at 19:45

1 Answers 1

When you click the"OK" button on the form in the browser window, an HTTP request is executed using the specified method specified in the action form.See HTTP.
Form data, depending on which method and type of content is used, is transmitted in different parts of this request in different formats.See HTTP/POST
This data gets into the Django backend and is routed there depending on the list of routes in the view.See the Django presentation.
In order to simplify work with forms, Django did a lot of things that make it easier to parse, validate and process form data.See working with forms in Django.

In general, you can not read to read.
  • In order to simplify working with forms, Django did a lot of things that make it easier to parse, validate and process form data. See working with forms in Django.

    Well, at the expense of this I am in the cruise :)
    In general, you can’t re-read it.

    Duck is and the fact that everything that I read, there is described the transfer of the form generated from under Jange. And if the form is not generated, but simply created manually, let's say it will be a GET request, but how to catch and use this GET in django? Or in the case of Django, this is generally a terrible blasphemy, so no one ever does, and in any case it is necessary to generate forms from under the django?
    – Thoughtful Toucan Oct 4 '18 at 10:43
  • how to catch and use this GET
    in Django>Bad read means that you ask such questions. GET to catch and use is from any hello world for Django.
    you need to generate forms from under django anyway

    No need. Django renders forms with a not-so-flexible template, so you can imprint them with your hands as needed. But on the server side, processing a request using forms is a mast hev, because of parsing, validation, and so on.
    – Erotic3 Oct 4 '18 at 10:51
  • Thoughtful Toucan, https://docs.djangoproject.com/en/2.1/ref/request -... in the same place about POST – Blue-eyed Butterfly Oct 4 '18 at 10:52
  • In general, I have implemented it in a “crutch” manner (since I don’t write to the database yet, and I don’t particularly need checking for correct input...).
    <form class="navbar-form navbar-left" method="GET"><div class="form-group"><input type="text" placeholder="Index..." class="form-control" name="index"></div><button type="submit" class="btn btn-success">Refresh </button></form>


    if'index'in request.GET: # Processing Forms indexObjectFromSite=request.GET ['index'] # Write the index from the site form
    – Thoughtful Toucan Oct 10 '18 at 08:48