Hi,
That should all be possible.
from django.db import models
class MyManager(models.Manager):
def complex_query_with_multiple_tables(self, mutiple, post, values):
# put your query here.
Collin
On Tuesday, December 23, 2014 12:49:49 PM UTC-6, pythonista wrote:
>
> Can this be used
Can this be used with a complex query in which multiple tables (classes)
are being joined?
I also have to pass multiple post values to the query.
Thanks for the example
On Monday, December 22, 2014 8:52:04 PM UTC-5, Collin Anderson wrote:
>
> Hi,
>
> There's a good example of creating a cust
Hi,
There's a good example of creating a custom manager here:
https://docs.djangoproject.com/en/dev/topics/db/managers/#custom-managers
Collin
On Saturday, December 20, 2014 8:28:57 AM UTC-6, pythonista wrote:
>
> Thank you for your response.
>
> Most of my data is complex raw sql.
> I had pla
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.
Tha
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)
- form
I usually put those functions in the view
cheers
L.
On 19 December 2014 at 08:12, 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
6 matches
Mail list logo