-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First part of refactoring the Dashboard to Django #616
First part of refactoring the Dashboard to Django #616
Conversation
Code refactored so that any file/path that is needed is generated using a central set of functions in config.py. This has been done as part of the refactor to Django so that the code can be moved around and any changes in paths can be changed in just one place.
Moved source code (not including code to fetch data), templates and static content into a dedicated source code folder to accommodate the transition to Django's directory structure. To make the Dashboard work the path constants were updated in config.py and some small path-related changes to the tests were applied so that they run in the new location.
Added Django to requirements.in and recompiled both requirements files.
Added basic Django project structure ready to be customised for the Dashboard. Doesn't really do anything right now but is ready to flesh out with Dashboard views.
Renamed plots.py to make_plots.py to be consistent with make_csv.py. Lightly refactored both scripts and added logging and progress bars to aid in development work. Required a minor change in requirements. Also changed destination folders to suit new structure for static files.
Created file for functions that are used in templates, and which aren't filters or tags, into a separate file. This commit moves firstint() from make_html.py.
This commit implements a URL structure for the Dashboard and includes views for the top level navigation of the Dashboard as well as the main pages in the Headlines section. This required changes in the templates to remove Flask-specific template functions and minor syntax changes that prevented rendering. The views themselves will eventually benefit from some optimisation. Note, this commit is a breaking change for make_html.py and now the repo will not generate a Flask website.
Moved licence page generation code into views.py and created view functions for the licenses page and the individual license detail page. Small adjustments were made to the templates for them to work with Django. Also moved license id code and title into text.py and added some license data generation code into views.py.
Moved custom filters from make_html.py into this file.
Since these table fragments were included in other templates I decided to move them into the _partials folder where other reusable components were stored.
This commit completes the refactoring of the publisher headlines by modifying the publisher template, adding some extra URL routes, and completing the view function for the publisher detail page. Also needed a minor change to the boxes template.
Updated both the readme (including converting to markdown) and contributors guide. The readme now includes information on how to run the Django version of the Dashboard.
For clarity in the repository this commit renames the directories that store the source code. All the source code in src/ was moved to dashboard/. Also, the actual Django app code was moved from src/dashboard/ to dashboard/ui/. This commit doesn't change the import statements to make the app run, this will be done in the next commit.
Change import statements and Django project strings to account for moving the dashboard from dashboard/ to ui/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. I'm going to merge this, as I think it's okay to break the merge-codeforiati-and-publishingstats
branch.
I see you've moved the licenses code into views.py, which is fine, but just a heads up that we might want to split that kind of thing out again if views.py gets too big.
0986915
into
merge-codeforiati-and-publishingstats
This PR is a breaking change and is the first part of the refactor of the Dashboard to Django. The PR contains the following changes:
make_plots.py
andmake_csv.py
).The refactoring process requires implementation of view functions and setting up of URL routes, but also changes in the templates so that they work in Django. Optimisation of the view functions and app will be required once the site is fully refactored.