I am developing my first relatively complex django project. I have written
some code and I'm not sure whether it belongs in an app's models.py or
views.py file.
I have written a class and a few functions that have to do with routing
content to views. For example, all the different *types* of pages on my
site are created as instances of a class name Page which represents a
generic page that is then customized with templates that are specific to
that type of page. For example, I create an order page for catering orders
with:
order/views.py:
from main.views import Page
def cater(request):
"""
Displays the order/cater page.
"""
page = Page(request,
menu_template='dn/menu/order.html',
submenu_template='order/menu/cater.html',
content_template='order/content/cater.html'
)
return page.render()
My question is this... Does Page belong in views.py or models.py?
Page does not subclass django.db.models.Model and there is no corresponding
back-end data. However it is an object that models common site-wide
elements of the site. I have a few other helper functions as well that are
used by the view functions, but that aren't directly called by urls.py.
What's the best practice for placing this stuff?
Thanks!
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.