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 be
purely for your database layout and all logic/database interaction
should be left to the views.py

On Jan 7, 10:16 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> 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 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(models.Model):
> >     ....
> >     def SaveNew(request)
> >     ....
>
> > ########################
>
> > Is there any particular benefit of nesting these "functions" within a
> > class? Or is it ok to simply put them into the views.py file?
>
> > Just wondered what best coding practice was.
>
> > Cheers,
> > Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to