Saturday, December 20, 2014

Re: Database queries location

Thank you for your response.  

Most of my data is complex raw sql.
I had placed it in the views and it is working as expected

I would like to migrate the raw sql to managers, 
Can you point me to one or more good examples of how the manager is coded and how the sql interacts with the views.

Thanks


On Friday, December 19, 2014 7:06:54 AM UTC-5, aRkadeFR wrote:
Depend exactly on what to compute for your post data.

I would almost write no logic code in the views.

I split every application as follow:
- managers.py: All the logic as a table level (raw SQL, complex queries)
- models.py: All logic as a row level / object level (python computing data)
- forms.py: All logic as forms data / processing / validation for
request data

Have a good one,

aRkadeFR

On 12/18/2014 10:12 PM, pythonista wrote:
> I understand that functions can be placed in the models fille
>
> However if I have complex queries that receive post input does the
>
>
> Query live in the model  the views or an external module
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/949a0a58-bc51-4bbc-91bb-87e29b5b5f4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment