[wingide-users] Django Template Browser

Adi Sieker adi at sieker.io
Fri Feb 21 17:54:19 EST 2014


Hi,

sorry for the weird quotes. I seem to have problems receiving emails, only the junk gets through.
So I'm picking up the replys from the mailing list archives.

Jason Decwes wrote:
>/  found in (means under the tree in the sub tree starting w/ that
/>/  installed app); q: are all in a "templates" folder under the installed app ?
/>/
/>/
/>/
/>/  On , Jason Decwes <jason_decwest at yahoo.com  <http://wingware.com/mailman/listinfo/wingide-users>
/>/  <mailto:jason_decwest at yahoo.com  <http://wingware.com/mailman/listinfo/wingide-users>>> wrote:
/>/  So the logic is that the TEMPLATES DIR  will shadow the installed apps
/>/  templates (of the same path), i.e. the logic is as follows
/>/
/>/  pseudo code imagined for django - is this the way it works?
/>/
/>/  INSTALLED_APPS_Roots = [ ... ]
/>/  TEMPLATE_DIRs = (I think this is a list and not one ; right ?) [ ... ]
/>/  def locate_template_to_use(...):
/>/       # if found in TEMPLATE_DIRs, return it.
/>/       # if found in INSTALLED_APPS_Roots return it
/>/       return None
/>/
/>/
/>/  then something like    template = locate_template_to_use('helloworld.html')
/>/
/>/  is how django does things and it "finds" one
/

That is in essence how Django does it. The order in which it checks is 
defined by the TEMPLATE_LOADER configuration.
Usually the application and filesystem loaders are in the config and the 
last loader one wins, so to speak.
I think there should be enough code in Django's template system todo all 
the heavy lifting.

Each Django application that supplies templates has a templates 
directory in the main package. If the application follows Django best 
practices the templates directory then contains a directory named after 
the package which in turn contains all the templates, possibly split 
into more subdirs. The application templates are found using the 
app_directories template loader.

i.e. .../site-packages/the_app/templates/the_app/list.html

The projects templates are found using the filesystem template loader. 
If the projects templates match the applications template path within 
the applications templates directory then the redefine/shadow/override 
the application template.

.../django_project/templates/the_app/list.html would redefine the above 
application template.


I guess I'll have to dig into the pylint panel.

Is there a big difference between Wing 4.x and 5.x when developing 
extension panels with a tree control?

Cheers
    Adi

P.S.: In the mean time I got my mail fixed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/wingide-users/attachments/20140221/3c51aa6d/attachment-0001.html>


More information about the wingide-users mailing list