2020-09-07 00:22:51 +08:00
|
|
|
# mia-accounting
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
The Mia! Accounting Django Application
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
```
|
|
|
|
Copyright (c) 2020 imacat.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
```
|
|
|
|
|
2020-09-07 00:47:43 +08:00
|
|
|
## Live Demonstration
|
|
|
|
|
|
|
|
https://accounting.imacat.idv.tw/accounting
|
2020-09-07 07:18:12 +08:00
|
|
|
* Username: `admin`
|
|
|
|
* Password: `12345`
|
2020-09-07 00:47:43 +08:00
|
|
|
|
2020-09-07 00:22:51 +08:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
`mia-accounting` requires Python 3.6 or above to work.
|
|
|
|
|
|
|
|
Install the required packages with `pip`.
|
|
|
|
|
|
|
|
```
|
|
|
|
pip install django django-dirtyfields titlecase django-decorator-include
|
|
|
|
```
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
### Download
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
The Mia! Accounting project is hosted on GitHub.
|
|
|
|
|
|
|
|
https://github.com/imacat/mia-accounting
|
|
|
|
|
|
|
|
You can download or clone
|
|
|
|
the project from from GitHub
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
```
|
|
|
|
git clone git@github.com:imacat/mia-accounting.git
|
|
|
|
```
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
Move the `accounting` and `mia_core` directories into your Django project root
|
2020-09-07 00:22:51 +08:00
|
|
|
directory.
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
### `settings.py`
|
2020-09-07 00:22:51 +08:00
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
Add these two applications in the `INSTALL_APPS` section of your `settings.py`.
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
```
|
2020-09-07 07:18:12 +08:00
|
|
|
INSTALLED_APPS = [
|
|
|
|
'mia_core.apps.MiaCoreConfig',
|
|
|
|
'accounting.apps.AccountingConfig',
|
|
|
|
...
|
|
|
|
]
|
2020-09-07 00:22:51 +08:00
|
|
|
```
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
Make sure the locale middleware is in the `MIDDLEWARE` section of your
|
|
|
|
`settings.py`, and add it if it is not added yet.
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
```
|
2020-09-07 07:18:12 +08:00
|
|
|
MIDDLEWARE = [
|
|
|
|
...
|
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
|
|
|
...
|
|
|
|
]
|
2020-09-07 00:22:51 +08:00
|
|
|
```
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
### `urls.py`
|
2020-09-07 00:22:51 +08:00
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
Add the `accounting` application in the `urlpatterns` of your `urls.py`.
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
```
|
2020-09-07 07:18:12 +08:00
|
|
|
urlpatterns = [
|
|
|
|
...
|
|
|
|
path('accounting/', decorator_include(login_required, 'accounting.urls')),
|
|
|
|
...
|
|
|
|
]
|
2020-09-07 00:22:51 +08:00
|
|
|
```
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
Make sure `i18n` and `jsi18n` are also in the `urlpatterns` of your `urls.py`,
|
|
|
|
and add them if they are not added yet.
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
```
|
2020-09-07 07:18:12 +08:00
|
|
|
urlpatterns = [
|
|
|
|
...
|
|
|
|
path('i18n/', include("django.conf.urls.i18n")),
|
|
|
|
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
|
|
|
|
...
|
|
|
|
]
|
2020-09-07 00:22:51 +08:00
|
|
|
```
|
|
|
|
|
2020-09-07 09:32:44 +08:00
|
|
|
### `base.html`
|
|
|
|
|
|
|
|
Add the following to the very beginning of your base template
|
|
|
|
`base.html`, before your first real HTML tag.
|
|
|
|
|
|
|
|
```
|
|
|
|
{% load mia_core %}
|
|
|
|
{% init_libs %}
|
|
|
|
{% block settings %}{% endblock %}
|
|
|
|
```
|
|
|
|
|
2020-09-07 10:12:23 +08:00
|
|
|
Add the CSS and JavaScripts in the `<head>...</head>` section of your
|
2020-09-07 09:32:44 +08:00
|
|
|
base template `base.html`.
|
|
|
|
|
|
|
|
```
|
|
|
|
{% for css in libs.css %}
|
|
|
|
<link rel="stylesheet" type="text/css" href="{% if css|is_static_url %}{% static css %}{% else %}{{ css }}{% endif %}" />
|
|
|
|
{% endfor %}
|
|
|
|
{% for js in libs.js %}
|
|
|
|
<script src="{% if js|is_static_url %}{% static js %}{% else %}{{ js }}{% endif %}"></script>
|
|
|
|
{% endfor %}
|
|
|
|
```
|
|
|
|
|
2020-09-07 07:18:12 +08:00
|
|
|
### Restart Your Web Project
|
2020-09-07 00:22:51 +08:00
|
|
|
|
|
|
|
## Bugs and Supports
|
|
|
|
|
|
|
|
Address all bugs and support requests to imacat@mail.imacat.idv.tw.
|
2020-09-07 07:18:12 +08:00
|
|
|
|
|
|
|
2020/9/7
|