GitXplorerGitXplorer
x

django-invoices

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
25ac6b73e217d6d38bd91e541134acbf7e9bd0a4

Add created by to the invoice preview

xxmudrii committed 4 years ago
Verified
10d5c97530f5f89f04d14a31d835a4fcf3881569

Remove null=True on owner fields

xxmudrii committed 4 years ago
Verified
a4a49117f353c7a18562b157bd76853c860bd6c7

Disable autocomplete for sensitive fields

xxmudrii committed 4 years ago
Verified
23d84d164e66c54c6db635e16eec6fa80db8578e

Restric removing users if invoice exists

xxmudrii committed 4 years ago
Verified
3518696d6dd48f30a9086c935b932b5bd1d64c51

Minor tweaks

xxmudrii committed 4 years ago
Verified
f4c4bf8b19c1963deb8c2c824994512542676925

Refine and document permissions

xxmudrii committed 4 years ago

README

The README file for this repository.

django-invoices

A simple invoicing app made in Django for the "Scripting Languages" course at the School of Computing, Belgrade.

Requirements

  • Python 3
  • Django
  • MySQL 5.7+
    • The run-mysql.sh script can be used on Linux/macOS operating systems to run MySQL server in a Docker container.
      • Using this script in the production environments is heavily discouraged.
      • The script is used such as: MYSQL_ROOT_PASSWORD=... ./hack/run-mysql.sh.
      • The script creates mysql directory in the ./hack directory mounted as /var/lib/mysql in the container. This directory is included in the .gitignore file.
  • MySQL Python client (mysqlclient)

Requirements regarding Python/Django dependencies can be found in the requirements.txt file.

Generating the requirements.txt File

The requirements.txt file can be generated by running the following command:

pip freeze > requirements.txt

Secrets

Before being able to reconcile the database and deploy the application, you must populate secrets required for application to work. The secrets should be placed in the ./invoices/secrets.py file. The ./invoices/secrets.py.tpl file can be used as a template to create the secrets.py file.

Reconciling Database

The database is generated and reconciled by creating and applying migrations. That can be done by using the manage.py script:

python manage.py makemigrations invoices_app
python manage.py migrate

Note: The database has to be created before applying migrations.

User Management

The application requires authentication and authorization in order to access and manage invoices. Users can be created using the application's register form (available on the /accounts/register endpoint). Users and permissions can be managed by using Django's built-in Admin panel.

Before you get started, you have to manually create an initial superuser account in order to access the Admin panel. That can be done by using the manage.py script:

python manage.py createsuperuser

Permissions and Access Control

The following permissions are used by the application:

  • login required to preview invoices
  • invoices_app.change_invoice required to create, edit, and manage invoices and invoice items
  • invoices_app.delete_invoice required to delete invoices

By default, users created using the register form are created without any permissions set.

Running Development Server

The development server can be started by running the following command from the project's root directory. The command starts a server on the port 8000 by default.

python manage.py runserver

License

This project is licensed under the Apache 2 license.