Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Templates should be namespaced and marked with block tags #165

Closed
poswald opened this Issue · 2 comments

2 participants

Paul Oswald Tom Christie
Paul Oswald

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%}
Paul Oswald poswald referenced this issue from a commit in poswald/django-rest-framework
Paul Oswald poswald Documentation on how to override the template; Closes Issue #165 bf717ef
Paul Oswald

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.

Tom Christie
Owner

+1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.