Re: Should logic appear in views.py

2008-01-07 Thread Tim Chase
> Does the function operate on a single model? Will it be run when you > already have the instance of the model? To add to Collin's comment, it doesn't even have to operate on a single model. It simply has to be a property of the model itself. Thus, it would make sense to have something like

Re: Should logic appear in views.py

2008-01-07 Thread Darthmahon
Thanks for the replies. Makes sense. The only reason I asked was because from my PHP MVC experience, all logic went into the C which itself referenced the M when it wanted to interact with the databse (such as inserting into a table). But what appears to be the case here is that the Model should

Re: Should logic appear in views.py

2008-01-07 Thread Alex Koshelev
When model method gets 'request' parameter its 99.99% ill-formed design of application. All request/response handling and most of business logic have to be in views.py or similar but not in models.py. On 7 янв, 12:38, Darthmahon <[EMAIL PROTECTED]> wrote: > Hey, > > I've just started working on m

Re: Should logic appear in views.py

2008-01-07 Thread Collin Grady
It depends a lot on the use case. Does the function operate on a single model? Will it be run when you already have the instance of the model? If so, it may be a good case for a model function, since it will already have access to the object it's a part of. General purpose helpers can go in view

Should logic appear in views.py

2008-01-07 Thread Darthmahon
Hey, I've just started working on my project but before getting too far down the line I wanted to ask the opinion of people on here. I've seen some code examples that show functions within the models.py file like so: from django.db import models class SaveArticle(model