If it is related to viewi generation, put it in views.py, etc.
If it doesn't fit anywhere, put it in a file named for the functional area. You are not restricted to the standard set of file names. However, something must import it if it is to have any effect. If you are using it in models.py, views.py urls.py, admin.py, etc., and you import it there, all well and good.
views.py, for example, isn't imported by django by default, but is imported because it is specified in some urls.py (either a direct import there, or because its module path is given as the head of a view specifier in a url pattern).
The models.py files of things in INSTALLED_APPS, and the ROOT_URLCONF get imported by django. Other urls.py files are imported, directly or via other urls.py files, by the ROOT_URLCONF. If you're using admin, then the ROOT_URLCONF typically runs admin.autodiscover(), which causes admin.py files to be imported.
Bill
On Tue, Feb 26, 2013 at 12:19 PM, Chen Xu <xuchen81@gmail.com> wrote:
Hi everybody in Django group,--I am a newbie to Django, I have a question about where you guys usually put your non-model class files.Ex, those model classes are in the model.pybut I want to create a non-model class which is not going to be saved into database at all. How should I do this?Thanks in advance
--
⚡ Chen Xu ⚡
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment