Templates should be namespaced and marked with block tags #165

Closed
poswald opened this Issue Feb 15, 2012 · 2 comments

Projects

None yet

2 participants

@poswald

Similar to Issue #162, I believe it is considered a best practice to namespace the templates directory of 3rd party libraries. For example django's admin is under django/contrib/admin/templates/admin/. This additional directory prevents the possibility of any collisions when looking up the templates by name.

Furthermore, it would be nice to offer some common override-able blocks in the default template. For example, if the template contained this:

<head>
    <link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/style.css'/>
    <title>{% block title %}Django REST framework{% endblock %} - {{ name }}</title>
</head>
...

Then a user can simply extend this template and set their own title in their template dir:

{% extends "djangorestframework/renderer.html" %}
{% block title %}My Site{% endblook%}
@poswald poswald added a commit to poswald/django-rest-framework that referenced this issue Feb 15, 2012
@poswald poswald Documentation on how to override the template; Closes Issue #165 bf717ef
@poswald

This is done but I kept it in a branch (poswald/djangorestframework@namespace-templates) because it conflicts a bit with Issue #162.. If you pull that one in, I'll send you a pull for this one as well.

@tomchristie
Owner

+1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment