Skip to content

Commit

Permalink
Move the helsinki specific templates to helevents and sensiblificate …
Browse files Browse the repository at this point in the history
…template copying to prevent old templates overriding new ones
  • Loading branch information
Rikuoja committed Sep 12, 2016
1 parent ed13fc6 commit 51d803c
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ Finally, you may install city-specific HTML page templates for the browsable API
```
python manage.py install_templates helsinki
```
This will install the templates/rest_framework/api.html.helsinki template,
This will install the `helevents/templates/rest_framework/api.html` template,
which contains Helsinki event data summary and license. Customize the template
for your favorite city by creating api.html.your_favorite_city.
for your favorite city by creating `your_favorite_city/templates/rest_framework/api.html`.
[Customizing the browsable API](http://www.django-rest-framework.org/topics/browsable-api/#customizing)

Running tests
Expand Down
8 changes: 4 additions & 4 deletions events/management/commands/install_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class Command(BaseCommand):
help = "Install a city specific HTML template"

def add_arguments(self, parser):
parser.add_argument('city_name', nargs=1, type=str)
parser.add_argument('city_directory', nargs=1, type=str)

def handle(self, *args, **options):
shutil.copyfile('templates/rest_framework/api.html.'+options['city_name'][0],
'events/templates/rest_framework/api.html')
self.stdout.write(self.style.SUCCESS('Successfully installed the template for '+options['city_name'][0]))
shutil.copyfile(options['city_directory'][0]+'/templates/rest_framework/api.html',
'templates/rest_framework/api.html')
self.stdout.write(self.style.SUCCESS('Successfully installed the template from '+options['city_directory'][0]))
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions templates/rest_framework/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Any templates in this directory will override the generic Linked Events page templates. You may install the Helsinki specific template from the helevents directory by
`python manage.py install_templates helevents`

0 comments on commit 51d803c

Please sign in to comment.