1

I am writing a Django web app which provides a user interface to do numerical analysis calculations. I want to have a form which submits a set of data using POST. This is the point where I am getting stuck. Should I put all of the calculation calls in the models, or the views, after receiving the POST data?

1
  • I think putting code in Models would make more sense. At least that how I'd prefer my code to be. By definition of MVC anything related to data should go into Models. Commented Mar 28, 2013 at 3:22

1 Answer 1

5

From the Django Docs

Business logic should go inside models. Views are to define the way data is presented to the user.

The “view” describes the data that gets presented to the user. It’s not necessarily how the data looks, but which data is presented. The view describes which data you see, not how you see it.

The view should be clean from business logic and should only be used to get the data to be displayed/presented on template or in other words let the view be used for view logic only.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.