[
  {
    "path": ".coveragerc",
    "content": "[report]\n# Regexes for lines to exclude from consideration\nexclude_lines =\n    # Have to re-enable the standard pragma\n    pragma: no cover\n\n    # Don't complain about missing debug-only code:\n    def __repr__\n    if self\\.debug\n    def __unicode__\n    def __repr__\n    if settings.DEBUG\n    raise NotImplementedError\n    from django\\.\n\n    # Don't complain if tests don't hit defensive assertion code:\n    raise AssertionError\n    raise NotImplementedError\n\n    # Don't complain if non-runnable code isn't run:\n    if 0:\n    if __name__ == .__main__.:\n\n[run]\nomit =\n    *tests*\n    *migrations*\n    *site-packages*\n    *src*\n    *settings*\n"
  },
  {
    "path": ".gitignore",
    "content": "*.log\n*.pot\n*.pyc\nlocal_settings.py\n\n.DS_Store\n.idea\n.hg\n.hgignore\n\ndist\ndjangular.egg-info\n\n.coverage\n\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: python\npython:\n  - \"2.7\"\ninstall:\n  - pip install coverage\n  - pip install $DJANGO\nscript:\n  - coverage run runtests.py\n  - coverage report -m\nenv:\n  - DJANGO=\"Django==1.5.12\"\n  - DJANGO=\"Django==1.6.11\"\n  - DJANGO=\"Django==1.7.11\"\n  - DJANGO=\"Django==1.8.12\"\n  - DJANGO=\"Django==1.9.5\"\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright 2013 Applied Security\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "MANIFEST.in",
    "content": "recursive-include djangular *\ninclude LICENSE\ninclude README.md\n"
  },
  {
    "path": "README.md",
    "content": "djangular\n=========\n\nA reusable app that provides better app integration with AngularJS. Djangular\nallows you to create AngularJS content per app, instead of creating a single\nmassive AngularJS application inside of Django. This allows you to selectively\nuse apps per site, as well as create a consistent structure across all of your\nDjango apps.\n\nThis is intended to be a Django version of the angular-seed project\n(https://github.com/angular/angular-seed). The current mindset is to limit the\namount of changes introduced by Djangular.\n\n\nFeatures\n--------\n\n+ Allows namespacing AngularJS content per Django app.  This allows the\n  AngularJS apps and modules to be included (or not) based on Django's settings,\n  and enforces a consistent structure to your Django/AngularJS apps.\n+ Includes an AngularJS module that includes a subset of features similar to\n  what Django provides in its templates.\n+ Adds a patch to AngularJS's $resource module, to enable end of URL slashes\n  that Django requires.\n+ Improves security by enabling of CSRF protection and JSON Vulnerability\n  between Django and AngularJS.\n+ ~~Scripts to allow running JS Unit and E2E tests, similar to the Django test\n  command.~~ This was removed for the time being and will be (re-)included in a\n  future release.\n+ Does not dictate how you use AngularJS inside your Django app.\n\n\nRequirements\n------------\n\n+ Currently requires Python 2.7.\n+ Supports Django >= 1.5, <= 1.9\n+ Supports AngularJS 1.2+ (including 1.3.x).\n+ ~~Local installs of Node.js and Karma for testing.~~\n\n\nInstallation\n------------\n\n+ You may install directly from pypi:\n\n        pip install djangular\n\n+ Or download the source and install it in a terminal/console:\n\n        python setup.py install\n\n+ Or download the source and move the djangular directory inside your django\n  project as an app (this is the least recommended approach).\n\n+ Djangular needs to be placed as an app inside a Django project and added to\n  the INSTALLED_APPS setting.\n\n        INSTALLED_APPS = (\n            ...\n            'djangular',\n            ...\n        )\n\n+ You will need to obtain a version of AngularJS and place it in the `static`\n  folder of one of your Django apps.  Djangular no longer includes a version of\n  AngularJS, since it updates too frequently.\n\n\nIncluding AngularJS content in your Django Apps\n-----------------------------------------------\n\nThe most popular feature of Djangular, this will both include and namespace your\nAngularJS content inside your Django apps.  Each Django app has its own\n\"angular\" folder, with a layout matching the angular-seed project. As a result,\nthe URLs for these get grouped into the `STATIC_URL` structure of Django.\n\n+ The staticfiles contrib library will need to be included in the INSTALLED_APPS\n  setting.\n\n        INSTALLED_APPS = (\n            ...\n            'django.contrib.staticfiles',\n            'djangular',\n            ...\n        )\n\n+ The STATICFILES_FINDERS needs to be updated to include\n  `djangular.finders.NamespacedAngularAppDirectoriesFinder`.\n\n        STATICFILES_FINDERS = (\n            'django.contrib.staticfiles.finders.FileSystemFinder',\n            'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n            'djangular.finders.NamespacedAngularAppDirectoriesFinder'\n        )\n\n+ Because of this new finder, the `findstatic` and `collectstatic` commands will\n  place the angular files in each app in an associated an `<app_name>/` folder.\n  You will not need to namespace each of your static directories with the name\n  of your Django application (unless you really want to).\n    * Example: If you have a Django app named `foo` and you are using the\n      default `STATIC_URL` in your settings, the main AngularJS module named\n      `foo` would be found at `foo/angular/app.js` on the file system and at\n      `static/foo/app.js` from the browser.\n    * This namespacing is done automatically.  This a `foo` app and a `bar` app\n      can both have an `app.js` inside their `angular` directories, and they\n      will not collide.\n    * Note: Because of these URLs, referring to AngularJS content in a separate\n      app should use a `../<separate_app>/` URL. This will help significantly\n      during testing to make sure paths are correct.\n    * Note: It is recommended to namespace the AngularJS code the same name as\n      the Django app. The created JS files do this already.\n\n+ To create an app that is already setup with the djangular (or angular-seed)\n  structure, run `python manage.py startangularapp <app_name>` from the command\n  line. This will create the files and directory structures needed for you to\n  get started.\n\n\nIncluding some Django template-like features in your AngularJS templates\n------------------------------------------------------------------------\n\nOne of the challenges in using AngularJS inside of Django is that you may not\nhave access to some needed variables that are always included in Django\ntemplates.  Djangular includes an AngularJS module to help with that.\n\n+ To use the AngularJS module that Djangular provides you, you'll need to add\n  the djangular app to your projects URLs.\n\n        urlpatterns = patterns('',\n            ...\n            url(r'^djangular/', include('djangular.urls')),\n            ...\n        )\n\n+ Alternatively, you may specify the DjangularModuleTemplateView specifically,\n  and customize the url.\n\n        from djangular.views import DjangularModuleTemplateView\n        ...\n\n        urlpatterns = patterns('',\n            ...\n            url(r'<custom_path>/djangular.js',\n                DjangularModuleTemplateView.as_view()),\n            ...\n        )\n\nThis will add a `djangular` AngularJS module to your front end code.  This\nmodule includes a `DjangoProperties` constant that includes whether the current\nuser is authenticated, the username, groups and roles of the current user and\nthe static and media urls from Django settings.  It also includes a `django`\nfilter, which does some basic substitution based on the properties constant.\n\n\nEnforcing the end slashes of your AngularJS Resources\n-----------------------------------------------------\n\n$resource is a convenient way to create REST-like services in AngularJS.\nHowever, there currently\n[is a bug](https://github.com/angular/angular.js/issues/992) in $resource that\nwill strip the ending slash, which means that $resource is unusable unless\n`settings.APPEND_SLASHES` is set to `FALSE`.\n\nDjangular used to patch this automatically, but it now includes a separate file\n(`djangular/static/js/resource_patch.js`) to handle this issue.  Simply include\nthat javascript file in your page after you have loaded `angular-resource.js`\nand ending slashes will be preserved in $resource.\n\n\nEnabling CSRF protection in AngularJS Templates\n-----------------------------------------------\n\nDjangular includes a JSON Vulnerability middleware that AngularJS knows how to\nprocess. To include this protection, add\n`djangular.middleware.AngularJsonVulnerabilityMiddleware` to the\n`MIDDLEWARE_CLASSES` setting. This only affects JSON requests (based on\nContent-Type), so this can be located fairly low in the middleware stack.\n\n        MIDDLEWARE_CLASSES = (\n            ...\n            'djangular.middleware.AngularJsonVulnerabilityMiddleware'\n        )\n\nOnce you have enabled CSRF protection in Django by adding the middleware\n`django.middleware.csrf.CsrfViewMiddleware` to the `MIDDLEWARE_CLASSES` setting,\nyou may use the same protection in AngularJS templates in addition to Django\ntemplate.  There are two different ways to enable this protection via djangular:\n\n+ Make your main app dependent on the `djangular` module and use the included\n  `csrf-token` directive (that wraps the Django `csrf_token` template tag)\n  inside the appropriate `form` tags in your HTML.\n\n        // Inside your JavaScript\n        angular.module('myApp', ['djangular', ...]);\n        ...\n        <!-- In your AngularJS Template -->\n        <div ng-app=\"my-app\">\n            ...\n            <form ...>\n                <csrf-token></csrf-token>\n            </form>\n        </div>\n\n+ Make your main app dependent on the `djangular.csrf`, which will add the\n  appropriate CSRF Token Header in all POSTs, PUTs and DELETEs.  Note that this\n  way is vulnerable to cross-site scripting if you make a post to a domain\n  outside your control.\n\n        angular.module('myApp', ['djangular.csrf', ...]);\n\nIf you allow a user to login (or logout) and don't redirect or reload the page,\nthe tags and cookies provided by both methods above will be stale.  The second\noption (using the `djangular.csrf` module) provides a `UpdateCSRFToken` function\nthat can be invoked with the new CSRF Token value.\n\n\nUsing Djangular in your Django Project\n--------------------------------------\n\nThis section describes some best practices in using Djangular. Please note that\nthese are guidelines and recommendations, but not the only way to use this\nproject.\n\n#### AngularJS as purely static content ####\n\nThe first way to use djangular is to have all of your static content live inside\nan angular app. This is perhaps the \"most correct\" way from an AngularJS\nstandpoint and perhaps the \"least correct\" way from a traditional Django\nperspective.\n\nIn doing this, you are only (or almost only) serving content from your static\ndomain and your Django development becomes strictly back-end focused for REST\nand/or service calls. Few to none of your Django views will produce HTML. You\ncan provide a redirect from a Django view to your static pages (if you like),\nalthough this can seem strange when your static content is served from a\ncompletely different domain. You may need to configure your web servers to\nallow remote Ajax calls from your static domain.\n\nThis approach allows you to use AngularJS with any number of back-ends, as\n(again) your Django app becomes an API for your AngularJS code to call. This\napproach can be very different from how your application is currently\narchitected.\n\nFrom our experience, if you decide to do this, we would recommend using local,\nrelative URLs to navigate between the apps instead of specifying the full URL.\nHowever, there are times when you will need to specify the full URL.\n\nThere is an AngularJS module called `djangular` that is rendered via the Django\ntemplating engine to obtain common template variables like the `STATIC_URL`,\n`MEDIA_URL`, the User object, etc.  This app includes a service called\n`DjangoProperties`, which will enable you to get access to those variables, and\na `django` filter, which follows the standard AngularJS filtering rules. The URL\nfor this JavaScript is `/djangular/app.js` (note that is not static).\n\nThe following is a sample route config that uses the aforementioned djangular\nangular app. Because AngularJS has not set up the $filter directive during the\nroute configuration, the DjangoProperties constant is the only way to obtain the\nSTATIC_URL. Using 'sample' as the name of the Django/AngularJS app:\n\n```javascript\nangular.module('sample', [\n    'djangular', 'sample.filters', 'sample.services', 'sample.directives',\n    'sample.controllers'\n    ]).config([\n        '$routeProvider','DjangoProperties',\n        function($routeProvider, DjangoProperties) {\n            $routeProvider.when('/view1', {\n                templateUrl: DjangoProperties.STATIC_URL +\n                    'sample/view1/view1.html', controller: 'View1Ctrl'});\n            $routeProvider.when('/view2', {\n                templateUrl: DjangoProperties.STATIC_URL +\n                    'sample/view2/view2.html', controller: 'View2Ctrl'});\n            $routeProvider.otherwise({redirectTo: '/view1'});\n        }\n    ]);\n```\n\n#### Django Templates as AngularJS Templates ####\n\nAnother way to integrate is to use your Django templates as your AngularJS\ntemplates. To do this, we highly recommend using Django 1.5 and heavy use of\nthe `{% verbatim %}` tag, since the Django and AngularJS templating syntaxes are\nidentical.\n\nThe big advantage of this is that it allows you to use all of the existing\ntemplate tags and ways of thinking that you are accustomed to using. If you are\nintegrating AngularJS into an existing Django project, this will seem the most\nappealing.\n\nThe downsides to this method are the following:\n+ The AngularJS developers recommend not doing this, because it is very easy\n  to get confused about which part of the template is being rendered on the\n  server side and which is being rendered on the client side. Almost every\n  developer on our team has tripped on this once or twice.\n+ The vast majority of HTML that your app is producing is the same on every\n  load... and should be static. However, without some cache configuration, the\n  server will have to render the content on every single request, resulting in\n  poorer performance.\n\n#### Using Django Templates to render the skeleton of the app ####\n\nWhat our team currently does is use a Django Template to render the skeleton of\nevery page, but the rest of the page (the partials, CSS and JS) are all included\nin the AngularJS app. This way, none of the CSS/JS dependencies are duplicated\nin multiple places.\n\nWhen our app renders the content, we pass in two variables to the RequestContext\n(and thus, to the template). The `app_name`, which is the name of the app, and\n`app_dependencies`, which is a list of app names whom the AngularJS app is\ndependent on. We make heavy use of Django Rest Framework\n(http://django-rest-framework.org/) to produce our views/REST Services and\nDjango Pipeline (https://github.com/cyberdelia/django-pipeline) to do our app\npackaging and JS/CSS Compression.\n\nThe template (more or less) looks like the following:\n```html\n{% load compressed %}  <!-- We use django-pipeline to do our packaging -->\n\n<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title>App Title</title>\n\t<link rel=\"shortcut icon\" href=\"{{ STATIC_URL }}images/app.ico\" />\n\n    <!--CSS imports-->\n    {% for dependency in app_dependencies %}\n        {% compressed_css dependency %}\n    {% endfor %}\n    {% compressed_css app_name %}\n\n    <!--AngularJS library imports-->\n    <script src=\"{{ STATIC_URL }}angular/angular-min.js\"></script>\n\n    <!--AngularJS app imports-->\n    <script src=\"/djangular/app.js\"></script>  <!-- The djangular app. -->\n    {% for dependency in app_dependencies %}\n        {% compressed_js dependency %}\n    {% endfor %}\n    {% compressed_js app_name %}\n\n</head>\n<body ng-app=\"{{app_name}}\">\n    <div class=\"app\" ng-view>\n    </div>\n</body>\n</html>\n```"
  },
  {
    "path": "djangular/__init__.py",
    "content": ""
  },
  {
    "path": "djangular/config/angularseed_template/angular/app.css",
    "content": "/* app css stylesheet */\n\n.menu {\n  list-style: none;\n  border-bottom: 0.1em solid black;\n  margin-bottom: 2em;\n  padding: 0 0 0.5em;\n}\n\n.menu:before {\n  content: \"[\";\n}\n\n.menu:after {\n  content: \"]\";\n}\n\n.menu > li {\n  display: inline;\n}\n\n.menu > li:before {\n  content: \"|\";\n  padding-right: 0.3em;\n}\n\n.menu > li:nth-child(1):before {\n  content: \"\";\n  padding: 0;\n}\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/app.js",
    "content": "'use strict';\n\n// Declare app level module which depends on views, and components\nangular.module('{{ app_name }}', [\n  'ngRoute',\n  '{{ app_name }}.view1',\n  '{{ app_name }}.view2',\n  '{{ app_name }}.version'\n]).\nconfig(['$routeProvider', function($routeProvider) {\n  $routeProvider.otherwise({redirectTo: '/view1'});\n}]);\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/components/version/interpolate-filter.js",
    "content": "'use strict';\n\nangular.module('{{ app_name }}.version.interpolate-filter', [])\n\n.filter('interpolate', ['version', function(version) {\n  return function(text) {\n    return String(text).replace(/\\%VERSION\\%/mg, version);\n  };\n}]);\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/components/version/interpolate-filter_test.js",
    "content": "'use strict';\n\ndescribe('{{ app_name }}.version module', function() {\n  beforeEach(module('{{ app_name }}.version'));\n\n  describe('interpolate filter', function() {\n    beforeEach(module(function($provide) {\n      $provide.value('version', 'TEST_VER');\n    }));\n\n    it('should replace VERSION', inject(function(interpolateFilter) {\n      expect(interpolateFilter('before %VERSION% after')).toEqual('before TEST_VER after');\n    }));\n  });\n});\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/components/version/version-directive.js",
    "content": "'use strict';\n\nangular.module('{{ app_name }}.version.version-directive', [])\n\n.directive('appVersion', ['version', function(version) {\n  return function(scope, elm, attrs) {\n    elm.text(version);\n  };\n}]);\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/components/version/version-directive_test.js",
    "content": "'use strict';\n\ndescribe('{{ app_name }}.version module', function() {\n  beforeEach(module('{{ app_name }}.version'));\n\n  describe('app-version directive', function() {\n    it('should print current version', function() {\n      module(function($provide) {\n        $provide.value('version', 'TEST_VER');\n      });\n      inject(function($compile, $rootScope) {\n        var element = $compile('<span app-version></span>')($rootScope);\n        expect(element.text()).toEqual('TEST_VER');\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/components/version/version.js",
    "content": "'use strict';\n\nangular.module('{{ app_name }}.version', [\n  '{{ app_name }}.version.interpolate-filter',\n  '{{ app_name }}.version.version-directive'\n])\n\n.value('version', '0.1');\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/components/version/version_test.js",
    "content": "'use strict';\n\ndescribe('{{ app_name }}.version module', function() {\n  beforeEach(module('{{ app_name }}.version'));\n\n  describe('version service', function() {\n    it('should return current version', inject(function(version) {\n      expect(version).toEqual('0.1');\n    }));\n  });\n});\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/index.html",
    "content": "<!DOCTYPE html>\n<!--[if lt IE 7]>      <html lang=\"en\" ng-app=\"{{ app_name }}\" class=\"no-js lt-ie9 lt-ie8 lt-ie7\"> <![endif]-->\n<!--[if IE 7]>         <html lang=\"en\" ng-app=\"{{ app_name }}\" class=\"no-js lt-ie9 lt-ie8\"> <![endif]-->\n<!--[if IE 8]>         <html lang=\"en\" ng-app=\"{{ app_name }}\" class=\"no-js lt-ie9\"> <![endif]-->\n<!--[if gt IE 8]><!--> <html lang=\"en\" ng-app=\"{{ app_name }}\" class=\"no-js\"> <!--<![endif]-->\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <title>My AngularJS App</title>\n  <meta name=\"description\" content=\"\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <link rel=\"stylesheet\" href=\"bower_components/html5-boilerplate/css/normalize.css\">\n  <link rel=\"stylesheet\" href=\"bower_components/html5-boilerplate/css/main.css\">\n  <link rel=\"stylesheet\" href=\"app.css\">\n  <script src=\"bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js\"></script>\n</head>\n<body>\n  <ul class=\"menu\">\n    <li><a href=\"#/view1\">view1</a></li>\n    <li><a href=\"#/view2\">view2</a></li>\n  </ul>\n\n  <!--[if lt IE 7]>\n      <p class=\"browsehappy\">You are using an <strong>outdated</strong> browser. Please <a href=\"http://browsehappy.com/\">upgrade your browser</a> to improve your experience.</p>\n  <![endif]-->\n\n  <div ng-view></div>\n\n  <div>Angular seed app: v<span app-version></span></div>\n\n  <!-- In production use:\n  <script src=\"//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js\"></script>\n  -->\n  <script src=\"bower_components/angular/angular.js\"></script>\n  <script src=\"bower_components/angular-route/angular-route.js\"></script>\n  <script src=\"app.js\"></script>\n  <script src=\"view1/view1.js\"></script>\n  <script src=\"view2/view2.js\"></script>\n  <script src=\"components/version/version.js\"></script>\n  <script src=\"components/version/version-directive.js\"></script>\n  <script src=\"components/version/interpolate-filter.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/view1/view1.html",
    "content": "<p>This is the partial for view 1.</p>\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/view1/view1.js",
    "content": "'use strict';\n\nangular.module('{{ app_name }}.view1', ['ngRoute'])\n\n.config(['$routeProvider', function($routeProvider) {\n  $routeProvider.when('/view1', {\n    templateUrl: 'view1/view1.html',\n    controller: 'View1Ctrl'\n  });\n}])\n\n.controller('View1Ctrl', [function() {\n\n}]);"
  },
  {
    "path": "djangular/config/angularseed_template/angular/view1/view1_test.js",
    "content": "'use strict';\n\ndescribe('{{ app_name }}.view1 module', function() {\n\n  beforeEach(module('{{ app_name }}.view1'));\n\n  describe('view1 controller', function(){\n\n    it('should ....', inject(function($controller) {\n      //spec body\n      var view1Ctrl = $controller('View1Ctrl');\n      expect(view1Ctrl).toBeDefined();\n    }));\n\n  });\n});"
  },
  {
    "path": "djangular/config/angularseed_template/angular/view2/view2.html",
    "content": "{% verbatim %}\n<p>This is the partial for view 2.</p>\n<p>\n  Showing of 'interpolate' filter:\n  {{ 'Current version is v%VERSION%.' | interpolate }}\n</p>\n{% endverbatim %}\n"
  },
  {
    "path": "djangular/config/angularseed_template/angular/view2/view2.js",
    "content": "'use strict';\n\nangular.module('{{ app_name }}.view2', ['ngRoute'])\n\n.config(['$routeProvider', function($routeProvider) {\n  $routeProvider.when('/view2', {\n    templateUrl: 'view2/view2.html',\n    controller: 'View2Ctrl'\n  });\n}])\n\n.controller('View2Ctrl', [function() {\n\n}]);"
  },
  {
    "path": "djangular/config/angularseed_template/angular/view2/view2_test.js",
    "content": "'use strict';\n\ndescribe('{{ app_name }}.view2 module', function() {\n\n  beforeEach(module('{{ app_name }}.view2'));\n\n  describe('view2 controller', function(){\n\n    it('should ....', inject(function($controller) {\n      //spec body\n      var view2Ctrl = $controller('View2Ctrl');\n      expect(view2Ctrl).toBeDefined();\n    }));\n\n  });\n});"
  },
  {
    "path": "djangular/finders.py",
    "content": "import django\nfrom django.contrib.staticfiles import finders as s_finders\n\n# Django rewrote the staticfiles storage internals in 1.7, so...\nif django.get_version() >= '1.7':\n    import os\n    import re\n\n    class NamespacedAppDirectoriesFinder(s_finders.AppDirectoriesFinder):\n        \"\"\"\n        A namedspace static files finder that looks in the angular directory of\n        each app as specified in the source_dir attribute.\n        \"\"\"\n        prepend_source_dir = False\n\n        def __init__(self, app_names=None, *args, **kwargs):\n            super(NamespacedAppDirectoriesFinder, self).__init__(\n                app_names, *args, **kwargs)\n\n            for app_name, storage in self.storages.items():\n                storage.prefix = os.path.join(*(app_name.split('.')))\n\n        def find_in_app(self, app, path):\n            if self.prepend_source_dir:\n                prefixed_path = os.path.join(self.source_dir, *(app.split('.')))\n            else:\n                prefixed_path = os.path.join(*(app.split('.')))\n\n            app_re = '^{}{}'.format(prefixed_path, os.sep)\n            if re.match(app_re, path):\n                return super(NamespacedAppDirectoriesFinder, self).find_in_app(\n                    app, re.sub(app_re, '', path)\n                )\n\n    class NamespacedAngularAppDirectoriesFinder(NamespacedAppDirectoriesFinder):\n        \"\"\"\n        A static files finder that looks in the angular directory of each app.\n        \"\"\"\n        source_dir = 'angular'\n\n    class NamespacedE2ETestAppDirectoriesFinder(NamespacedAppDirectoriesFinder):\n        \"\"\"\n        A static files finder that looks in the tests/e2e directory of each app.\n        \"\"\"\n        source_dir = os.path.join('tests', 'e2e')\n        prepend_source_dir = True\n\nelse:\n    from . import storage\n\n    class NamespacedAngularAppDirectoriesFinder(s_finders.AppDirectoriesFinder):\n        \"\"\"\n        A static files finder that looks in the angular directory of each app.\n        \"\"\"\n        storage_class = storage.NamespacedAngularAppStorage\n\n    class NamespacedE2ETestAppDirectoriesFinder(s_finders.AppDirectoriesFinder):\n        \"\"\"\n        A static files finder that looks in the tests/e2e directory of each app.\n        \"\"\"\n        storage_class = storage.NamespacedE2ETestAppStorage\n\n    class NamespacedLibTestAppDirectoriesFinder(s_finders.AppDirectoriesFinder):\n        \"\"\"\n        A static files finder that looks in the tests/lib directory of each app.\n        \"\"\"\n        storage_class = storage.NamespacedLibTestAppStorage"
  },
  {
    "path": "djangular/management/__init__.py",
    "content": ""
  },
  {
    "path": "djangular/management/commands/__init__.py",
    "content": ""
  },
  {
    "path": "djangular/management/commands/startangularapp.py",
    "content": "import django\nimport os\n\nfrom django.core import management as mgmt\nfrom django.core.management.templates import TemplateCommand\nfrom djangular import utils\n\n\nclass Command(utils.SiteAndPathUtils, TemplateCommand):\n    help = (\"Creates a Djangular app directory structure for the given app \"\n            \"name in the current directory or optionally in the given \"\n            \"directory.\")\n\n    if django.get_version() >= \"1.7\":\n        requires_system_checks = False\n    else:\n        requires_model_validation = False\n\n    def handle(self, name, target=None, **options):\n        mgmt.call_command('startapp', name, target, **options)\n\n        # Override the options to setup the template command.\n        options.update({\n            'template': os.path.join(\n                self.get_djangular_root(), 'config', 'angularseed_template'),\n            'extensions': ['.html', '.js'],  # Parse HTML And JS files\n            'files': ['app.css']\n        })\n\n        super(Command, self).handle(\n            'app', name, target or name, **options)\n"
  },
  {
    "path": "djangular/middleware.py",
    "content": "\nclass AngularJsonVulnerabilityMiddleware(object):\n    \"\"\"\n    A middleware that inserts the AngularJS JSON Vulnerability request on JSON responses.\n    \"\"\"\n    # The AngularJS JSON Vulnerability content prefix. See http://docs.angularjs.org/api/ng.$http\n    CONTENT_PREFIX = b\")]}',\\n\"\n\n    # Make this class easy to extend by allowing class level access.\n    VALID_STATUS_CODES = [200, 201, 202]\n    VALID_CONTENT_TYPES = ['application/json']\n\n    def process_response(self, request, response):\n        if response.status_code in self.VALID_STATUS_CODES and response['Content-Type'] in self.VALID_CONTENT_TYPES:\n            response.content = self.CONTENT_PREFIX + response.content\n\n        return response"
  },
  {
    "path": "djangular/models.py",
    "content": "# No models needed."
  },
  {
    "path": "djangular/static/js/resource_patch.js",
    "content": "try {\n    if (angular.version.full > \"1.3\") {\n        angular.module('ngResource').config([\n            '$resourceProvider', function($resourceProvider) {\n                $resourceProvider.defaults.stripTrailingSlashes = false;\n            }\n        ]);\n    } else {\n        angular.module('ngResource').config([\n            '$provide', '$httpProvider',\n            function($provide, $httpProvider) {\n                $provide.decorator('$resource', function($delegate) {\n                    return function() {\n                        if (arguments.length > 0) {  // URL\n                            arguments[0] = arguments[0].replace(/\\/$/, '\\\\/');\n                        }\n\n                        if (arguments.length > 2) {  // Actions\n                            angular.forEach(arguments[2], function(action) {\n                                if (action && action.url) {\n                                    action.url = action.url.replace(/\\/$/, '\\\\/');\n                                }\n                            });\n                        }\n\n                        return $delegate.apply($delegate, arguments);\n                    };\n                });\n\n                $provide.factory('djangularEnforceSlashInterceptor', function() {\n                    return {\n                        request: function(config) {\n                            config.url = config.url.replace(/[\\/\\\\]+$/, '/');\n                            return config;\n                        }\n                    };\n                });\n\n                $httpProvider.interceptors.push('djangularEnforceSlashInterceptor');\n            }\n        ]);\n    }\n} catch (err) {\n    console.log('The ngResource module could not be found.');\n}"
  },
  {
    "path": "djangular/storage.py",
    "content": "import django\n\nif django.get_version() < '1.7':\n    import os\n    from re import sub\n\n    from django.contrib.staticfiles.storage import AppStaticStorage\n\n    class NamespacedAngularAppStorage(AppStaticStorage):\n        \"\"\"\n        A file system storage backend that takes an app module and works\n        for the ``app`` directory of it.  The app module will be included\n        in the url for the content.\n        \"\"\"\n        source_dir = 'angular'\n\n        def __init__(self, app, *args, **kwargs):\n            \"\"\"\n            Returns a static file storage if available in the given app.\n            \"\"\"\n            # app is the actual app module\n            self.prefix = os.path.join(*(app.split('.')))\n            super(NamespacedAngularAppStorage, self).__init__(app, *args, **kwargs)\n\n        def path(self, name):\n            name = sub('^' + self.prefix + os.sep.encode('string-escape'), '', name)\n            return super(NamespacedAngularAppStorage, self).path(name)\n\n\n    class NamespacedE2ETestAppStorage(AppStaticStorage):\n        \"\"\"\n        A file system storage backend that takes an app module and works\n        for the ``tests/e2e`` directory of it.  The app module will be included\n        in the url for the content.  NOTE: This should only be used for\n        end-to-end testing.\n        \"\"\"\n        source_dir = os.path.join('tests', 'e2e')\n\n        def __init__(self, app, *args, **kwargs):\n            \"\"\"\n            Returns a static file storage if available in the given app.\n            \"\"\"\n            # app is the actual app module\n            prefix_args = [self.source_dir] + app.split('.')\n            self.prefix = os.path.join(*prefix_args)\n            super(NamespacedE2ETestAppStorage, self).__init__(app, *args, **kwargs)\n\n\n    class NamespacedLibTestAppStorage(AppStaticStorage):\n        \"\"\"\n        A file system storage backend that takes an app module and works\n        for the ``tests/lib`` directory of it.  The app module will be included\n        in the url for the content.  NOTE: This should only be used for\n        end-to-end testing.\n        \"\"\"\n        source_dir = os.path.join('tests', 'lib')\n\n        def __init__(self, app, *args, **kwargs):\n            \"\"\"\n            Returns a static file storage if available in the given app.\n            \"\"\"\n            # app is the actual app module\n            prefix_args = app.split('.') + ['lib']\n            self.prefix = os.path.join(*prefix_args)\n            super(NamespacedLibTestAppStorage, self).__init__(app, *args, **kwargs)\n"
  },
  {
    "path": "djangular/templates/djangular_module.js",
    "content": "// All template syntax is commented so this can be loaded as a normal JS file.\n// {% load static %}\nvar djangular = angular.module('djangular', []).\n    constant('DjangoProperties', {\n        'STATIC_URL': '{% get_static_prefix %}',\n        'MEDIA_URL': '{% get_media_prefix %}',\n        'USER_NAME': '{{ user.username|escapejs }}',\n        'GROUP_NAMES': [ // {% for group in user.groups.all %}\n            '{{ group.name|escapejs }}', // {% endfor %}\n        ],\n        'IS_AUTHENTICATED': 'True' === '{{ user.is_authenticated|escapejs }}',\n        'IS_STAFF': 'True' === '{{ user.is_staff }}',\n        'IS_SUPERUSER': 'True' === '{{ user.is_superuser }}'\n    }).\n    filter('django', ['DjangoProperties', function(DjangoProperties) {\n        return function(text) {\n            for (var constant in DjangoProperties) {\n                text = text.replace('%' + constant + '%', DjangoProperties[constant]);\n                text = text.replace(constant, DjangoProperties[constant]);\n            }\n            return text;\n        }\n    }]).\n    directive('djangoHref', ['$filter', function($filter) {\n        return {\n            restrict: 'A',\n            priority: 99, // same as ng-href\n            link: function(scope, elem, attrs) {\n                attrs.$observe('djangoHref', function(value) {\n                    if (!value) return;\n                    attrs.$set('href', $filter('django')(value));\n                });\n            }\n        };\n    }]).\n    directive('djangoSrc', ['$filter', function($filter) {\n        return {\n            restrict: 'A',\n            priority: 99, // same as ng-src\n            link: function(scope, elem, attrs) {\n                attrs.$observe('djangoSrc', function(value) {\n                    if (!value) return;\n                    attrs.$set('src', $filter('django')(value));\n                });\n            }\n        };\n    }]).\n    directive('csrfToken', function() {\n        return {\n            restrict: 'E',\n            template: \"{% csrf_token %}\" || \"<span></span>\",\n            replace: true\n        };\n    });\n\n// {% if not disable_csrf_headers %}\n// Assign the CSRF Token as needed, until Angular provides a way to do this properly (https://github.com/angular/angular.js/issues/735)\nvar djangularCsrf = angular.module('djangular.csrf', ['ngCookies']).\n    config(['$httpProvider', function($httpProvider) {\n        // cache $httpProvider, as it's only available during config...\n        djangularCsrf.$httpProvider = $httpProvider;\n    }]).\n    factory('UpdateCsrfToken', function() {\n        return function(csrfToken) {\n            djangularCsrf.$httpProvider.defaults.headers.post['X-CSRFToken'] = csrfToken;\n            djangularCsrf.$httpProvider.defaults.headers.put['X-CSRFToken'] = csrfToken;\n            if (!djangularCsrf.$httpProvider.defaults.headers.delete)\n                djangularCsrf.$httpProvider.defaults.headers.delete = {};\n            djangularCsrf.$httpProvider.defaults.headers.delete['X-CSRFToken'] = csrfToken;\n        };\n    }).\n    run(['$cookies', 'UpdateCsrfToken', function($cookies, UpdateCsrfToken) {\n        UpdateCsrfToken($cookies['csrftoken']);\n    }]);\n// {% endif %}\n"
  },
  {
    "path": "djangular/tests/__init__.py",
    "content": "import django\n\nif django.VERSION < (1, 6):\n    from djangular.tests.test_base import *\n    from djangular.tests.test_finders import *\n    from djangular.tests.test_middleware import *\n    from djangular.tests.test_storage import *\n    from djangular.tests.test_utils import *\n    from djangular.tests.test_commands import *\n    from djangular.tests.test_urls import *\n"
  },
  {
    "path": "djangular/tests/test_base.py",
    "content": "import django\nimport os\n\nfrom django.test import SimpleTestCase\n\nBASE_DIR = os.path.abspath(os.path.dirname(__file__))\n\n\ndef _call_test_func(self, test_fn):\n    apps = None\n    need_to_call_unset = False\n\n    if django.get_version() >= '1.7':\n        from django.apps import apps\n\n        if not apps.is_installed('djangular.config.angularseed_template'):\n            apps.set_installed_apps(tuple([\n                'djangular.config.angularseed_template']))\n            need_to_call_unset = True\n\n    try:\n        test_fn(self)\n    finally:\n        if apps and need_to_call_unset:\n            apps.unset_installed_apps()\n\n\ndef test_with_angularseed_template_as_django_app(test_fn):\n    def fn(self):\n        extra_init_py_files = []\n        try:\n            # Temporarily make the template dirs into python modules by adding\n            # the __init__.py files.\n            for directory in [\n                    'config', os.path.join('config', 'angularseed_template')]:\n                current_file_name = os.path.join(\n                    BASE_DIR, '..', directory, '__init__.py')\n                current_file = open(current_file_name, 'w')\n                extra_init_py_files.append(current_file)\n                current_file.close()\n\n        except Exception as e:\n            self.fail('Could not create files due to {0}'.format(e.message))\n\n        else:\n            _call_test_func(self, test_fn)\n\n        finally:\n            for py_file in extra_init_py_files:\n                if os.path.exists(py_file.name):\n                    os.remove(py_file.name)\n\n                compiled_file_name = '{0}c'.format(py_file.name)\n                if os.path.exists(compiled_file_name):\n                    os.remove(compiled_file_name)\n\n    return fn\n\n\nclass TestAngularSeedAsPythonModuleTest(SimpleTestCase):\n\n    @test_with_angularseed_template_as_django_app\n    def test_init_py_created(self):\n        self.assertTrue(os.path.exists('{0}/../config/__init__.py'.format(BASE_DIR)))"
  },
  {
    "path": "djangular/tests/test_commands.py",
    "content": "import os\nimport shutil\n\nfrom django.test import TestCase\nfrom django.utils._os import upath\n\nfrom djangular.management.commands.startangularapp import Command as StartAngularAppCommand\n\n\nclass StartAngularAppCommandTests(TestCase):\n    def setUp(self):\n        # Clean up app directory that is created\n        test_dir = os.path.abspath(os.path.dirname(upath(__file__)))\n        demo_app_path = os.path.join(test_dir, '../../demo')\n        self.addCleanup(shutil.rmtree, demo_app_path)\n\n    def test_runs(self):\n        StartAngularAppCommand().handle('demo', verbosity=1)\n"
  },
  {
    "path": "djangular/tests/test_finders.py",
    "content": "import django\nimport os\n\nfrom djangular.tests.test_base import test_with_angularseed_template_as_django_app\nfrom djangular import finders\nfrom django.test import SimpleTestCase\n\nAPP_BASE_DIR = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))\n\n\nclass NamespacedAngularAppDirectoriesFinderTest(SimpleTestCase):\n    @test_with_angularseed_template_as_django_app\n    def test_find(self):\n        if django.get_version() >= '1.7':\n            finder = finders.NamespacedAngularAppDirectoriesFinder(\n                app_names=['djangular.config.angularseed_template'])\n        else:\n            finder = finders.NamespacedAngularAppDirectoriesFinder(\n                apps=['djangular.config.angularseed_template'])\n\n        self.assertEqual(\n            finder.find('djangular/config/angularseed_template/index.html'),\n            '{0}/config/angularseed_template/angular/index.html'.format(\n                APP_BASE_DIR)\n        )\n\n\nclass NamespacedE2ETestAppDirectoriesFinderTest(SimpleTestCase):\n\n    @test_with_angularseed_template_as_django_app\n    def test_find(self):\n        self.skipTest('E2E Testing is not implemented yet...')\n\n        if django.get_version() >= '1.7':\n            finder = finders.NamespacedE2ETestAppDirectoriesFinder(\n                app_names=['djangular.config.angularseed_template'])\n        else:\n            finder = finders.NamespacedE2ETestAppDirectoriesFinder(\n                apps=['djangular.config.angularseed_template'])\n\n        self.assertEqual(\n            finder.find(\n                'tests/e2e/djangular/config/angularseed_template/runner.html'),\n            '{0}/config/angularseed_template/tests/e2e/runner.html'.format(\n                APP_BASE_DIR)\n        )\n"
  },
  {
    "path": "djangular/tests/test_middleware.py",
    "content": "from djangular import middleware\n\nfrom django.test import SimpleTestCase\nfrom django.http import HttpRequest, HttpResponse\n\n\nclass AngularJsonVulnerabilityMiddlewareTest(SimpleTestCase):\n\n    def test_that_middleware_does_nothing_to_html_requests(self):\n        resp = HttpResponse(content_type='text/html', content='<html></html>')\n        mware = middleware.AngularJsonVulnerabilityMiddleware()\n        mware.process_response(HttpRequest(), resp)\n\n        self.assertEqual(resp.content, '<html></html>')\n\n    def test_that_middleware_does_nothing_to_js_requests(self):\n        resp = HttpResponse(content_type='text/javascript', content='var blah = [];')\n        mware = middleware.AngularJsonVulnerabilityMiddleware()\n        mware.process_response(HttpRequest(), resp)\n\n        self.assertEqual(resp.content, 'var blah = [];')\n\n    def test_that_middleware_does_nothing_to_invalid_json_requests(self):\n        resp = HttpResponse(content_type='application/json', content='[1, 2, 3]', status=400)\n        mware = middleware.AngularJsonVulnerabilityMiddleware()\n        mware.process_response(HttpRequest(), resp)\n\n        self.assertEqual(resp.content, '[1, 2, 3]')\n\n    def test_that_middleware_adds_prefix_to_valid_json_requests(self):\n        resp = HttpResponse(content_type='application/json', content='[1, 2, 3]')\n        mware = middleware.AngularJsonVulnerabilityMiddleware()\n        mware.process_response(HttpRequest(), resp)\n\n        self.assertEqual(resp.content, mware.CONTENT_PREFIX + '[1, 2, 3]')\n"
  },
  {
    "path": "djangular/tests/test_storage.py",
    "content": "import django\n\nif django.get_version() < '1.7':\n    from djangular import storage\n    from django.test import SimpleTestCase\n\n    from djangular.tests.test_base import test_with_angularseed_template_as_django_app\n\n    class NamespacedAppAngularStorageTest(SimpleTestCase):\n        def test_source_dir_is_angular(self):\n            self.assertEqual(\n                storage.NamespacedAngularAppStorage.source_dir, 'angular')\n\n        def test_prefix_is_given_app_name(self):\n            app_storage = storage.NamespacedAngularAppStorage('djangular')\n            self.assertEqual(app_storage.prefix, 'djangular')\n\n        @test_with_angularseed_template_as_django_app\n        def test_prefix_is_given_app_name_for_more_complicated_scenario(self):\n            app_storage = storage.NamespacedAngularAppStorage(\n                'djangular.config.angularseed_template')\n            self.assertEqual(app_storage.prefix,\n                             'djangular/config/angularseed_template')\n\n\n    class NamespacedE2ETestAppStorageTest(SimpleTestCase):\n        def test_source_dir_is_tests(self):\n            self.assertEqual(\n                storage.NamespacedE2ETestAppStorage.source_dir, 'tests/e2e')\n\n        def test_prefix_is_given_app_name(self):\n            app_storage = storage.NamespacedE2ETestAppStorage('djangular')\n            self.assertEqual(app_storage.prefix, 'tests/e2e/djangular')\n\n        @test_with_angularseed_template_as_django_app\n        def test_prefix_is_given_app_name_for_more_complicated_scenario(self):\n            app_storage = storage.NamespacedE2ETestAppStorage(\n                'djangular.config.angularseed_template')\n            self.assertEqual(app_storage.prefix,\n                             'tests/e2e/djangular/config/angularseed_template')"
  },
  {
    "path": "djangular/tests/test_urls.py",
    "content": "from django.core.urlresolvers import reverse\nfrom django.test import TestCase\n\n\nclass UrlsTests(TestCase):\n    def test_urls_import(self):\n        \"\"\"Smoke test to make sure urls imports are valid.\"\"\"\n        self.assertEqual('/app.js', reverse('djangular-module'))\n"
  },
  {
    "path": "djangular/tests/test_utils.py",
    "content": "import os\n\nfrom djangular import utils\nfrom django.test import SimpleTestCase\n\n\nclass SiteAndPathUtilsTest(SimpleTestCase):\n\n    site_utils = utils.SiteAndPathUtils()\n\n    def test_djangular_root(self):\n        current_dir = os.path.dirname(os.path.abspath(__file__))\n        djangular_dir = os.path.dirname(current_dir)\n        self.assertEqual(djangular_dir, self.site_utils.get_djangular_root())\n"
  },
  {
    "path": "djangular/tests/unit/filterSpec.js",
    "content": "'use strict';\n\n/* jasmine specs for filters go here */\n\ndescribe('filter', function() {\n    beforeEach(module('djangular'));\n\n    describe('django', function() {\n        it('should replace STATIC_URL inside of percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before %STATIC_URL% after')).\n                toEqual('before {% get_static_prefix %} after');\n        }));\n\n        it('should replace STATIC_URL without percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before STATIC_URL after')).\n                toEqual('before {% get_static_prefix %} after');\n        }));\n\n        it('should replace MEDIA_URL inside of percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before %MEDIA_URL% after')).\n                toEqual('before {% get_media_prefix %} after');\n        }));\n\n        it('should replace MEDIA_URL without percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before MEDIA_URL after')).\n                toEqual('before {% get_media_prefix %} after');\n        }));\n\n        it('should replace USER_NAME inside of percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before %USER_NAME% after')).\n                toEqual('before {{ user.username|escapejs }} after');\n        }));\n\n        it('should replace USER_NAME without percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before USER_NAME after')).\n                toEqual('before {{ user.username|escapejs }} after');\n        }));\n\n        it('should replace IS_AUTHENTICATED inside of percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before %IS_AUTHENTICATED% after')).\n                toEqual('before false after');\n        }));\n\n        it('should replace IS_AUTHENTICATED without percent signs', inject(function(djangoFilter) {\n            expect(djangoFilter('before IS_AUTHENTICATED after')).\n                toEqual('before false after');\n        }));\n    });\n});\n"
  },
  {
    "path": "djangular/urls.py",
    "content": "from django.conf.urls import patterns, url\nfrom .views import DjangularModuleTemplateView\n\nurlpatterns = patterns('',\n    url(r'^app.js$', DjangularModuleTemplateView.as_view(), name='djangular-module')\n)\n"
  },
  {
    "path": "djangular/utils.py",
    "content": "import os\n\nCURRENT_DIR = os.path.dirname(os.path.abspath(__file__))\n\n\nclass SiteAndPathUtils(object):\n    \"\"\"\n    Mixin to get commonly used directories in Djangular Commands\n    \"\"\"\n    def get_default_site_app(self):\n        \"\"\"\n        Retrieves the name of the django app that contains the site config.\n        \"\"\"\n        return os.environ[\"DJANGO_SETTINGS_MODULE\"].replace('.settings', '')\n\n    def get_default_site_path(self):\n        \"\"\"\n        Retrieves the name of the django app that contains the site config.\n        \"\"\"\n        settings_module = __import__(self.get_default_site_app())\n        return settings_module.__path__[0]\n\n    def get_djangular_root(self):\n        \"\"\"\n        Returns the absolute path of the djangular app.\n        \"\"\"\n        return CURRENT_DIR\n\n    def get_project_root(self):\n        \"\"\"\n        Retrieves the root of the project directory without having to have a entry in the settings.\n        \"\"\"\n        default_site = self.get_default_site_app()\n        path = self.get_default_site_path()\n        # Move up one directory per '.' in site path.  Most sites are at the top level, so this is just a precaution.\n        for _ in range(len(default_site.split('.'))):\n            path = os.path.dirname(path)\n        return path\n"
  },
  {
    "path": "djangular/views.py",
    "content": "from django.views.generic.base import TemplateView\n\n\nclass DjangularModuleTemplateView(TemplateView):\n    content_type = 'text/javascript'\n    template_name = 'djangular_module.js'\n    disable_csrf_headers = False\n\n    def get_context_data(self, **kwargs):\n        context = super(DjangularModuleTemplateView, self).get_context_data(**kwargs)\n        context['disable_csrf_headers'] = self.disable_csrf_headers\n        return context\n"
  },
  {
    "path": "runtests.py",
    "content": "#!/usr/bin/env python\nimport sys\n\nimport django\n\nfrom django.conf import settings\nfrom django.core.management import execute_from_command_line\n\n\nif not settings.configured:\n    settings.configure(\n        DATABASES={\n            'default': {\n                'ENGINE': 'django.db.backends.sqlite3',\n            }\n        },\n        INSTALLED_APPS=[\n            'django.contrib.auth',\n            'django.contrib.contenttypes',\n            'django.contrib.sessions',\n            'django.contrib.messages',\n            'django.contrib.sites',\n            'djangular',\n        ],\n        MIDDLEWARE_CLASSES=[\n            'django.middleware.common.CommonMiddleware',\n            'django.contrib.sessions.middleware.SessionMiddleware',\n            'django.middleware.csrf.CsrfViewMiddleware',\n            'django.contrib.auth.middleware.AuthenticationMiddleware',\n            'django.contrib.messages.middleware.MessageMiddleware',  \n        ],\n        ROOT_URLCONF='djangular.urls'\n    )\n\n\nimport logging\nlogging.basicConfig(\n    level = logging.DEBUG,\n    format = '%(asctime)s %(levelname)s %(message)s',\n)\nlogging.disable(logging.CRITICAL)\n\n\ndef runtests():\n    argv = sys.argv[:1] + ['test', 'djangular']\n    execute_from_command_line(argv)\n\n\nif __name__ == '__main__':\n    runtests()\n"
  },
  {
    "path": "setup.py",
    "content": "try:\n    from setuptools import setup, find_packages\nexcept ImportError:\n    from distribute_setup import use_setuptools\n    use_setuptools()\n    from setuptools import setup, find_packages\n\nsetup(\n    name='djangular',\n    version='0.3.0b1',\n    description=\"A reusable app that provides better app integration with AngularJS.\",\n    long_description=\"\"\"\nA reusable app that provides better app integration with AngularJS.  Djangular\nallows you to create AngularJS content per app, instead of creating a single\nmassive AngularJS application inside of Django.  This allows you to selectively\nuse apps per site, as well as create a consistent structure across all of your\nDjango apps.\n\nThis is intended to be a Django version of the angular-seed project\n(https://github.com/angular/angular-seed).  The current mindset is to limit the\namount of changes introduced by Djangular.\n\"\"\",\n    keywords='djangular django angular angularjs',\n    license='Apache',\n    packages=['djangular'],\n    include_package_data=True,\n    author='Brian Montgomery',\n    author_email='brianm@appliedsec.com',\n    url='http://github.com/appliedsec/djangular',\n    classifiers=[\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Operating System :: OS Independent\",\n        \"Topic :: Internet :: WWW/HTTP\",\n        \"Topic :: Internet :: WWW/HTTP :: Dynamic Content\",\n        \"Topic :: Software Development :: Libraries :: Python Modules\",\n        ],\n    )\n"
  }
]