A
A
Anton2016-12-27 15:54:12
Django
Anton, 2016-12-27 15:54:12

Where is the best place to process the form?

Hello. For example, I have a page on which there is a form, how can I process it better? In one method to process POST and GET requests, or to give the page in one method, and process the form in another?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rPman, 2016-12-27
@rPman

- Petka, devices:
- ten!
- what ten?
- what appliances?
ps for beauty and ease of code support in the future, spread everything as much as possible from each other, your code, consisting of one method za... support others.
for me, everything related to the interface should be exclusively on the client side, everything related to data and logic - on the server, so javascript, ajax / websocket

T
tema_sun, 2016-12-27
@tema_sun

different. Use built-in Class-Based Views (for GET - get(), for POST - post() ).
Be sure to check out CBV. Expand them as needed. Only after mastering this technique, start using function-based views if you hit some CBV restrictions.
With this approach, it will be easier for other developers to understand you and you can avoid inventing a couple of dozen bicycles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question