Essentially, I have flatpages in my app, but I want to avoid creating the entire content within the flatpages table (the html is fairly long).
Further, I need to access other models within this content. However, because flatpages requires from django.contrib.flatpages import views
and the other views (those in views.py
) require from . import views
it appears that I can only use one or the other? Is there some way around this?
I'm fairly new to Django and can't seem to find an answer to this question, but essentially my flatpage default is a header/drawer and I want to create a content that has access to several models at once, but it would be nice to have the contents themselves in separate html files instead of in the flatpages table in the database. Is this possible?
Thanks!
I'm not sure why you're saying you can only import one or the other. You can of course import as many views modules into your urls.py as you like; to avoid name conflicts you can either import the view functions directly rather than the module - eg from myapp.views import my_view_function
- or import the modules under different names with "as": from myapp import views as myapp_views
.