I have a long method in my Model that generates an SVG from the model instance.
It creates a Dot graph and then renders it.
Should this code be in a view instead?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In my opinion, it should. The model is the description of the data, and holds functionality to add, delete and update records in your datastore. The view describes data that is visible to the user. As you are creating data to be presented to your users, I’d say this better fits the view. This is most in line with what the Django FAQ says. But, to quote the conclusion of the linked FAQ entry, “At the end of the day, of course, it comes down to getting stuff done”.