On 2/06/2016 12:54 AM, sevenrrain...@gmail.com wrote:
I seen multiple project structure for Django, but they didn't discuss in
detail about structuring mixins.

I see that some people use mixins.py , others utils folder.

Taking in consideration that I have many mixins for views(generic
login,authorization and more specific for the project) and for models
and I don't know if using only 1 file mixins.py is the best solutions.

So, I'm looking for recommendations, from projects with many mixins
(views and models) ?

What works for me may not work for you. Just organise things the way you feel comfortable. The bottom line is that if you use mixins they have to be imported into the module where they are used.

That means ...

from overthere.mixins import thismixin

If you share mixins across a number of apps in the same project make an extra app called "common" and make a directory mixins so ...

from common.mixins import thismixin

If you want to keep view and model mixins separate then ...

from common.views.mixins import thismixin

or

from app.views.mixins import thismixin

or

from . import thisviewmixin
from . import thismodelmixin

And so on. Make up a structure which suits your brain productivity-wise so you don't have to think about where you are importing from and you can go straight there without thinking when you want to edit them.

Practicality beats purity


--
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+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/0f1259db-17e2-4d5a-96cb-cf28e97fed96%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/0f1259db-17e2-4d5a-96cb-cf28e97fed96%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27b316dd-2669-5ebc-fe13-f2fe5778e3df%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to