Compare commits

..

30 Commits
0.8.0 ... 0.8.4

Author SHA1 Message Date
Herculino Trotta
fee5b93cea Merge pull request #117
fix: empty strings not considered as None when importing
2025-01-31 16:54:34 -03:00
Herculino Trotta
a7d8f94412 fix: empty strings not considered as None when importing 2025-01-31 16:54:04 -03:00
Herculino Trotta
44b87da423 Merge pull request #115
feat: expose current version
2025-01-31 11:15:35 -03:00
Herculino Trotta
85794f5c01 feat: expose current version 2025-01-31 11:15:15 -03:00
Herculino Trotta
f246d115e2 Merge pull request #114 from eitchtee/dev
ci: allow for manual custom docker release
2025-01-31 01:31:36 -03:00
Herculino Trotta
aae85ecf94 ci: allow for manual custom docker release 2025-01-31 01:31:09 -03:00
Herculino Trotta
ec911c0085 Merge pull request #113 from eitchtee/dev
feat: gracefully handle bigger title on info cards
2025-01-31 01:20:09 -03:00
Herculino Trotta
7b77f6f363 feat: gracefully handle bigger title on info cards 2025-01-31 01:19:28 -03:00
Herculino Trotta
239e9c4b2a Merge pull request #112
feat: turn quick transactions buttons in a component and gracefully handle buttons w/ long text
2025-01-31 01:13:06 -03:00
Herculino Trotta
5abd0b8d3c feat: turn quick transactions buttons in a component and gracefully handle buttons w/ long text 2025-01-31 01:12:45 -03:00
Herculino Trotta
320217f64a Remove procrastinate name from .env 2025-01-30 14:47:13 -03:00
Herculino Trotta
2735906d5e Update README.md 2025-01-30 14:45:24 -03:00
Herculino Trotta
1f03edcc2e Update README.md 2025-01-30 14:43:55 -03:00
Herculino Trotta
1405976292 Update README.md 2025-01-30 12:22:20 -03:00
Herculino Trotta
6a06d0ee88 Update README.md 2025-01-30 11:26:44 -03:00
Herculino Trotta
49c17f75b4 Merge pull request #111 from eitchtee/eitchtee-patch-1
Update README.md
2025-01-30 11:00:07 -03:00
Herculino Trotta
2ff6d69fac Update README.md 2025-01-30 10:59:49 -03:00
Herculino Trotta
3023f33d3d Merge pull request #110
fix: 'tags__id' does not resolve to an item that supports prefetching
2025-01-30 00:26:40 -03:00
Herculino Trotta
b5671fcd0e fix: 'tags__id' does not resolve to an item that supports prefetching 2025-01-30 00:26:07 -03:00
Herculino Trotta
48408cead8 fix: 'tags__id' does not resolve to an item that supports prefetching 2025-01-30 00:22:37 -03:00
Herculino Trotta
cd7ecd42ea Merge pull request #109
feat: allow for a subset of markdown (bold, italics, strikethrough, links) when displaying notes
2025-01-29 13:53:09 -03:00
Herculino Trotta
0b83ad6b3e feat: allow for a subset of markdown (bold, italics, strikethrough, links) when displaying notes 2025-01-29 13:52:46 -03:00
Herculino Trotta
d0ef08252e Merge pull request #108
feat: improve transactions list loading time
2025-01-29 13:47:05 -03:00
Herculino Trotta
1140d9c896 feat: improve transactions list loading time
Prefetch more values and allow them to be cached
2025-01-29 13:46:06 -03:00
Herculino Trotta
b2843a1ec1 Merge pull request #106 from DragonHeart69/main
Small change in Dutch translation
2025-01-29 08:40:31 -03:00
Dimitri Decrock
d25aba7be9 small change to number format again 2025-01-29 06:12:54 +01:00
Dimitri Decrock
c3eaca3e9a Merge branch 'eitchtee:main' into main 2025-01-29 06:10:17 +01:00
Herculino Trotta
5677706452 Merge pull request #105
fix: unable to load transactions on first login
2025-01-29 00:56:22 -03:00
Herculino Trotta
5bf7f9f272 fix: unable to load transactions on first login 2025-01-29 00:56:06 -03:00
Dimitri Decrock
65ad51c273 smal change to number format 2025-01-28 19:16:52 +01:00
21 changed files with 223 additions and 651 deletions

View File

@@ -1,6 +1,5 @@
SERVER_NAME=wygiwyh_server
DB_NAME=wygiwyh_pg
PROCRASTINATE_NAME=wygiwyh_procrastinate
DEBUG=false
URL = https://...

View File

@@ -2,9 +2,20 @@ name: Release Pipeline
on:
release:
types: [created]
types: [ created ]
push:
branches: [ main ]
workflow_dispatch:
inputs:
tag:
description: 'Custom tag name for the image'
required: true
type: string
ref:
description: 'Git ref to checkout (branch, tag, or SHA)'
required: true
default: 'main'
type: string
env:
IMAGE_NAME: wygiwyh
@@ -18,6 +29,13 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
if: github.event_name == 'workflow_dispatch'
- name: Checkout code (non-manual)
uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch'
- name: Log in to Docker Hub
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
@@ -39,6 +57,8 @@ jobs:
file: ./docker/prod/django/Dockerfile
push: true
provenance: false
build-args: |
VERSION=nightly
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:nightly
platforms: linux/amd64,linux/arm64
cache-from: type=gha
@@ -52,9 +72,26 @@ jobs:
file: ./docker/prod/django/Dockerfile
push: true
provenance: false
build-args: |
VERSION=${{ github.event.release.tag_name }}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push custom image
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/prod/django/Dockerfile
push: true
provenance: false
build-args: |
VERSION=${{ github.event.inputs.tag }}
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

462
README.md
View File

@@ -90,13 +90,12 @@ If you want to run WYGIWYH locally, on your env file:
You can now access localhost:OUTBOUND_PORT
> [!NOTE]
> If you're planning on running this behind Tailscale or other similar service also add your machine given IP to `DJANGO_ALLOWED_HOSTS`
> - If you're planning on running this behind Tailscale or other similar service also add your machine given IP to `DJANGO_ALLOWED_HOSTS`
> - If you're going to use another IP that isn't localhost, add it to `DJANGO_ALLOWED_HOSTS`, without `http://`
> [!NOTE]
> If you're going to use another IP that isn't localhost, add it to `DJANGO_ALLOWED_HOSTS`, without `http://`
## Building from source
Features are only added to main when ready, if you want to run the latest version, you must build from source.
## Latest changes
Features are only added to `main` when ready, if you want to run the latest version, you must build from source or use the `:nightly` tag on docker. Keep in mind that there can be undocumented breaking changes.
All the required Dockerfiles are [here](https://github.com/eitchtee/WYGIWYH/tree/main/docker/prod).
@@ -104,442 +103,31 @@ All the required Dockerfiles are [here](https://github.com/eitchtee/WYGIWYH/tree
[nwithan8](https://github.com/nwithan8) has kindly provided a Unraid template for WYGIWYH, have a look at the [unraid_templates](https://github.com/nwithan8/unraid_templates) repo.
WYGIWYH and WYGIWYH--Procrastinate should be available on the Unraid Store. You need both for all features.
WYGIWYH is available on the Unraid Store. You'll need to provision your own postgres (version 15 or up) database.
## Enviroment Variables
| variable | type | default | explanation |
|-------------------------------|-------------|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| DJANGO_ALLOWED_HOSTS | string | localhost 127.0.0.1 | A list of space separated domains and IPs representing the host/domain names that WYGIWYH site can serve. [Click here](https://docs.djangoproject.com/en/5.1/ref/settings/#allowed-hosts) for more details |
| HTTPS_ENABLED | true\|false | false | Whether to use secure cookies. If this is set to true, the cookie will be marked as “secure”, which means browsers may ensure that the cookie is only sent under an HTTPS connection |
| URL | string | http://localhost http://127.0.0.1 | A list of space separated domains and IPs (with the protocol) representing the trusted origins for unsafe requests (e.g. POST). [Click here](https://docs.djangoproject.com/en/5.1/ref/settings/#csrf-trusted-origins ) for more details |
| SECRET_KEY | string | "" | This is used to provide cryptographic signing, and should be set to a unique, unpredictable value. |
| DEBUG | true\|false | false | Turns DEBUG mode on or off, this is useful to gather more data about possible errors you're having. Don't use in production. |
| SQL_DATABASE | string | None *required | The name of your postgres database |
| SQL_USER | string | user | The username used to connect to your postgres database |
| SQL_PASSWORD | string | password | The password used to connect to your postgres database |
| SQL_HOST | string | localhost | The adress used to connect to your postgres database |
| SQL_PORT | string | 5432 | The port used to connect to your postgres database |
| SESSION_EXPIRY_TIME | int | 2678400 (31 days) | The age of session cookies, in seconds. E.g. how long you will stay logged in |
| ENABLE_SOFT_DELETE | true\|false | false | Whether to enable transactions soft delete, if enabled, deleted transactions will remain in the database. Useful for imports and avoiding duplicate entries. |
| KEEP_DELETED_TRANSACTIONS_FOR | int | 365 | Time in days to keep soft deleted transactions for. If 0, will keep all transactions indefinitely. Only works if ENABLE_SOFT_DELETE is true. |
| TASK_WORKERS | int | 1 | How many workers to have for async tasks. One should be enough for most use cases |
# How it works
## Models
Check out our [Wiki](https://github.com/eitchtee/WYGIWYH/wiki) for more information.
### Transactions
Transactions are the core feature of WYGIWYH, representing expenses or income in your accounts. Each transaction consists of the following fields:
#### Type
- **Income**: A positive amount entering your account
- **Expense**: A negative amount exiting your account
#### Paid Status
A transaction can be either:
- **Current**: When marked as paid
- **Projected**: When marked as unpaid
#### Account
The account associated with the transaction. Required, limited to one account per transaction.
#### Entity
The party involved in the transaction:
- For **Income**: The paying entity
- For **Expense**: The receiving entity
Optional field.
#### Date
The date when the transaction occurred. Required.
#### Reference Date
One of **WYGIWYH**'s key features. The reference date determines which month a transaction should count towards. For example, you can have a transaction that occurred on January 26th count towards February's finances.
Optional - defaults to the transaction date's month if not specified.
> [!CAUTION]
> While designed primarily for credit card closing dates, this feature allows for debt rolling across months. Use responsibly to maintain accurate financial tracking.
#### Type
- Income, meaning a positive amount (usually) entering your account
- Expense, meaning a negative amount exiting your account
#### Description
The name or purpose of the transaction. Required.
#### Amount
The monetary value of the transaction. Required.
#### Category
The primary classification of the transaction. Optional.
#### Tags
Additional labels for transaction categorization. Optional.
#### Notes
Additional information about the transaction. Optional.
![img_4.png](.github/img/readme_transaction.png)
### Installment Plan
An Installment Plan is a helper model that generates a series of recurring transactions over a fixed period.
#### Core Fields
- **Account**: The account for all transactions in the plan. Required.
- **Entity**: The paying or receiving party for all transactions. Optional.
- **Description**: The name of the installment plan, used for all transactions. Required.
- **Notes**: Additional information applied to all transactions. Optional.
#### Installment Configuration
- **Number of Installments**: Total number of transactions to create (e.g., 1/10, 2/10)
- **Installment Start**: Initial counting point
- **Start Date**: Date of the first transaction
- **Reference Date**: Reference date for the first transaction
- **Recurrence**: Frequency of transactions (e.g., Monthly)
![img_1.png](.github/img/readme_installment_plan.png)
### Transaction Details
- **Amount**: Value for each transaction. Required.
- **Category**: Primary classification for all transactions. Optional.
- **Tags**: Labels applied to all transactions. Optional.
### Recurring Transaction
A Recurring Transaction is a helper model that generates recurring transactions indefinitely or until a certain date.
#### Core Fields
- **Account**: The account for all transactions in the plan. Required.
- **Entity**: The paying or receiving party for all transactions. Optional.
- **Description**: The name of the recurring transaction, used for all transactions. Required.
- **Notes**: Additional information applied to all transactions. Optional.
#### Recurring Transaction Configuration
- **Start Date**: Date of the first transaction. Required.
- **Reference Date**: Reference date for the first transaction. Optional.
- **Recurrence Type**: Frequency of transactions (e.g., Monthly). Required.
- **Recurrence Interval**: The interval between transactions (e.g. every 1 month, every 2 weeks, etc.). Required.
- **End date**: When new transactions should stop being created. Optional.
#### Transaction Details
- **Amount**: Value for each transaction. Required.
- **Category**: Primary classification for all transactions. Optional.
- **Tags**: Labels applied to all transactions. Optional.
#### Other information
- Recurring transactions are checked and created every midnight using Procrastinate.
- **WYGIWYH** tries to keep at most **6** future transactions created at any time.
- If you delete a recurring transaction it will not be recreated.
- You can stop or pause a recurring transaction at any time on the config page (/recurring-trasanctions/)
![img_3.png](.github/img/readme_recurring_transaction.png)
### Account
Accounts represent different financial entities where transactions occur. They have the following attributes:
- **Name**: A unique identifier for the account.
- **Group**: An optional [account group](#account-groups) the account belongs to for organizational purposes.
- **Currency**: The primary [currency](#currency) of the account.
- **Exchange Currency**: An optional currency used for exchange rate calculations.
- **Is Asset**: A boolean indicating if the account is considered an asset (counts towards net worth).
- **Is Archived**: A boolean indicating if the account is archived (doesn't show up in active lists or count towards net worth).
### Account Groups
Account Groups are used to organize accounts into logical categories. They consist of:
- **Name**: A unique identifier for the group.
### Currency
Currencies represent different monetary units. They include:
* **Code**: A unique identifier for the currency (e.g., USD, EUR).
* **Name**: The full name of the currency.
* **Decimal Place**: The number of decimal places used for the currency.
* **Prefix**: An optional symbol or text that comes before the amount.
* **Suffix**: An optional symbol or text that comes after the amount.
### Exchange Rate
Exchange Rates store conversion rates between currencies:
* **From Currency**: The source currency.
* **To Currency**: The target currency.
* **Rate**: The conversion rate.
* **Date**: The date the rate was recorded or is valid for.
### Category
Categories are used to classify transactions:
* **Name**: A unique identifier for the category.
* **Muted**: Muted categories won't count towards your monthly total.
* **Active**: A boolean indicating if the category is currently in use. This will disable its use on new transactions.
### Tag
Tags provide additional labeling for transactions:
* **Name**: A unique identifier for the tag.
* **Active**: A boolean indicating if the category is currently in use. This will disable its use on new transactions.
### Entity
Entities represent parties involved in transactions:
* **Name**: A unique identifier for the entity.
* **Active**: A boolean indicating if the entity is currently in use. This will disable its use on new transactions.
---
## Helper actions
### Transfer
A transfer happens when you move a monetary value from one account to another. This will create two transactions, one expense and one income with the values set by the user.
Contrary to other finance trackers, due to our multi-currency support, **WYGIWYH**'s transfer system allows for non-zero transfers.
![img.png](.github/img/readme_transfer.png)
### Balance (Account Reconciliation)
A balance is a easy way of updating your accounts balance. It creates a transaction with the difference between the balance currently in **WYGIWYH** and the new balance informed by you.
This can be useful for savings accounts or other interest accruing investments.![img_2.png](.github/img/readme_balance.png)
---
## Views
### Monthly
The Monthly view provides an overview of your financial activity for a specific month. It includes:
* Total income and expenses for the month
* Daily spending allowance calculation
* List of transactions for the month
> [!NOTE]
> Reference dates are taken into account here.
### Yearly by currency
This view gives you a yearly summary of your finances grouped by currency. It shows:
* Total income and expenses for each currency
* Monthly breakdown of income and expenses
### Yearly by account
Similar to the [yearly by currency](#yearly-by-currency) view, but groups the data by account instead.
### Calendar
The Calendar view presents your transactions in a monthly calendar format, allowing you to see your financial activity day by day. It includes:
* Visual representation of daily transaction totals
* Ability to view details of transactions for each day
> [!NOTE]
> Reference dates are **not** taken into account here.
### Networh
#### Current
The Current Net Worth view shows your present financial standing, including:
* Total value of all asset accounts
* Breakdown of assets by account and currency
* Historical net worth trend
#### Projected
The Projected Net Worth view estimates your future financial position based on current data and recurring transactions. It includes:
* Your total net worth with projected and current transactions
* Breakdown of assets by account and currency
* Historical and future net worth trend
### All Transactions
This view provides a comprehensive list of all transactions across all accounts. Features include:
* Advanced filtering and sorting options
* Detailed information
You can use this to see how much you spent on a given category, or a given day, etc..
### Configuration and Management
#### Management
The Management section in the navbar allows you to add and edit most elements of WYGIWYH, including:
* Accounts and Groups
* Currencies and Exchange Rates
* Categories, Tags and Entities
* Rules
#### User Settings
WYGIWYH allows users to personalize their experience through customizable settings. Each user can configure:
* **Language**: Choose your preferred interface language.
* **Timezone**: Set your local timezone for accurate date and time display.
* **Start Page**: Select which page you want to see first when you log in.
* **Sound Preferences**: Toggle sound effects on or off.
* **Amount Display**: Choose to show or hide monetary amounts by default.
To access and modify these settings:
1. Click on your username in the top-right corner of the page.
2. Select "Settings" from the dropdown menu.
3. Adjust your preferences as desired.
4. Click "Save" to apply your changes.
These settings ensure that WYGIWYH adapts to your personal preferences and working style.
#### Django Admin
From here you can also access Django's own admin site.
> [!WARNING]
> Most side effects aren't triggered from the admin.
> Only use it if you know what you're doing or were told by a developer to do so.
---
## Tools
### Calculator
The calculator is a floating widget that can be toggled by clicking the calculator icon on the navbar or by pressing <kbd>Alt</kbd> + <kbd>C</kbd> on any page.
It allows for any math expression supported by [math.js](https://mathjs.org).
![calculator](.github/img/readme_calculator.gif)
### Dollar Cost Average Tracker
The DCA Tracker can be accessed from the navbar's **Tools** menu.
It allows for tracking DCA strategies and getting helpful information and insights.
> [!IMPORTANT]
> Currently DCA exists separately from your main transactions. You will need to add your entries manually.
<img src=".github/img/readme_dca_1.png" width="45%"></img> <img src=".github/img/readme_dca_2.png" width="45%"></img>
### Unit Price Calculator
The Unit Price Calculator can be accessed from the navbar's **Tools** menu.
This is a self-contained tool for comparing and finding the most cost-efficient item quickly and easily.
Input the price and the amount of each item, the cheapeast will be highlighted in green, and the most expensive in red.
You can add additional items by clicking the _Add_ button at the end of the page.
> [!NOTE]
> This doesn't do unit convertion. The amount of all items needs to be on the same the unit for proper functioning.
![img.png](.github/img/readme_unit_price_calculator.png)
### Currency Converter
The Currency Converter is a tool that allows you to quickly convert amounts between different currencies.
> [!NOTE]
> There's no external Exchange Rate fetching. This uses the Exchange Rates configured in the [Management](#configuration-and-management) page for [Exchange Rates](#exchange-rate)
## Automation
### API
WYGIWYH has a comprehensive API, it's documentation can be accessed on `<your-wygiwyh-url>/api/docs/`
> [!NOTE]
> While the API works, there's still much to be added to it to equipare functionality with the main web app.
### Transaction Rules
Transaction Rules are a powerful feature in WYGIWYH that allow for automatic modification of transactions based on specified criteria. This can save time and ensure consistency in your financial tracking.
Key Aspects of Transaction Rules:
* **Conditions**: Set specific criteria that a transaction must meet for the rule to apply. This can include attributes like description, amount, account, etc.
* **Actions**: Define what changes should be made to a transaction when the conditions are met. This can include setting categories, tags, or modifying other fields.
* **Activation Options**: Rules can be set to apply when transactions are created, updated, or both.
#### Actions and Conditions
When creating a new rule, you will need to add a Condition and, later, Actions.
Both use a limited subset of Python, via [SimpleEval](https://github.com/danthedeckie/simpleeval).
The Condition must evaluate to True or False, and the Action must evaluate to a value that will be set on the selected field.
You may use any of the available [variables](#available-variables) and [functions](#available-functions).
#### Available variables
* `account_name`
* `account_id`
* `account_group_name`
* `account_group_id`
* `is_asset_account`
* `is_archived_account`
* `category_name`
* `category_id`
* `tag_names`
* `tag_ids`
* `entities_names`
* `entities_ids`
* `is_expense`
* `is_income`
* `is_paid`
* `description`
* `amount`
* `notes`
* `date`
* `reference_date`
#### Available functions
* `relativedelta`
#### Examples
Add a tag to an income transaction if it happens in a specific account
```
If...
account_name == "My Investing Account" and is_income
Then...
Set Tags to
tag_names + ["Yield"]
```
---
Move credit card transactions to next month when they happen at a cutoff date
```
If...
account_name == "My credit card" and date.day >= 26 and reference_date.month == date.month
Then...
Set Reference Date to
reference_date + relativedelta(months=1)).replace(day=1)
```
# Caveats and Warnings
- I'm not an accountant, some terms and even calculations might be wrong. Make sure to open an issue if you see anything that could be improved.

View File

@@ -31,10 +31,8 @@ SECRET_KEY = os.getenv("SECRET_KEY", "")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv("DEBUG", "false").lower() == "true"
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS", "localhost 127.0.0.1").split(" ")
CSRF_TRUSTED_ORIGINS = os.environ.get("URL", "http://localhost http://127.0.0.1").split(
" "
)
ALLOWED_HOSTS = os.getenv("DJANGO_ALLOWED_HOSTS", "localhost 127.0.0.1").split(" ")
CSRF_TRUSTED_ORIGINS = os.getenv("URL", "http://localhost http://127.0.0.1").split(" ")
# Application definition
@@ -128,11 +126,11 @@ WSGI_APPLICATION = "WYGIWYH.wsgi.application"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("SQL_DATABASE"),
"USER": os.environ.get("SQL_USER", "user"),
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
"HOST": os.environ.get("SQL_HOST", "localhost"),
"PORT": os.environ.get("SQL_PORT", "5432"),
"NAME": os.getenv("SQL_DATABASE"),
"USER": os.getenv("SQL_USER", "user"),
"PASSWORD": os.getenv("SQL_PASSWORD", "password"),
"HOST": os.getenv("SQL_HOST", "localhost"),
"PORT": os.getenv("SQL_PORT", "5432"),
}
}
@@ -388,3 +386,4 @@ PWA_SERVICE_WORKER_PATH = BASE_DIR / "templates" / "pwa" / "serviceworker.js"
ENABLE_SOFT_DELETE = os.getenv("ENABLE_SOFT_DELETE", "false").lower() == "true"
KEEP_DELETED_TRANSACTIONS_FOR = int(os.getenv("KEEP_DELETED_ENTRIES_FOR", "365"))
APP_VERSION = os.getenv("APP_VERSION", "unknown")

View File

@@ -0,0 +1,52 @@
from typing import Optional
import mistune
from django import template
from django.utils.safestring import mark_safe
from mistune import HTMLRenderer, Markdown, BlockParser, InlineParser, safe_entity
from mistune.plugins.formatting import strikethrough as plugin_strikethrough
from mistune.plugins.url import url as plugin_url
register = template.Library()
class CustomRenderer(HTMLRenderer):
def link(self, text: str, url: str, title: Optional[str] = None) -> str:
s = '<a rel="nofollow" target="_blank" href="' + self.safe_url(url) + '"'
if title:
s += ' title="' + safe_entity(title) + '"'
return s + ">" + text + "</a>"
def paragraph(self, text: str) -> str:
return text + "\n"
def softbreak(self) -> str:
return "\n"
def blank_line(self) -> str:
return "\n"
block = BlockParser()
block.rules = ["blank_line"]
inline = InlineParser(hard_wrap=False)
inline.rules = [
"emphasis",
"link",
"auto_link",
"auto_email",
"linebreak",
"softbreak",
]
markdown = Markdown(
renderer=CustomRenderer(escape=False),
block=block,
inline=inline,
plugins=[plugin_strikethrough, plugin_url],
)
@register.filter(name="limited_markdown")
def limited_markdown(value):
return mark_safe(markdown(value))

View File

@@ -0,0 +1,9 @@
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag(name="settings")
def settings_value(name):
return getattr(settings, name, "")

View File

@@ -489,18 +489,18 @@ class ImportService:
value = None
if isinstance(mapping.source, str):
value = row.get(mapping.source)
value = row.get(mapping.source, None)
elif isinstance(mapping.source, list):
for source in mapping.source:
value = row.get(source)
if value is not None:
value = row.get(source, None)
if value:
break
else:
# If source is None, use None as the initial value
value = None
# Use default_value if value is None
if value is None:
if not value:
value = mapping.default
# Apply transformations

View File

@@ -69,7 +69,7 @@ def transactions_list(request, month: int, year: int):
if "order" in request.GET:
order = request.GET["order"]
if order != request.session["monthly_transactions_order"]:
if order != request.session.get("monthly_transactions_order", "default"):
request.session["monthly_transactions_order"] = order
f = TransactionsFilter(request.GET)
@@ -87,6 +87,7 @@ def transactions_list(request, month: int, year: int):
"account__exchange_currency",
"account__currency",
"installment_plan",
"entities",
)
)

View File

@@ -328,7 +328,7 @@ def transaction_all_list(request):
if "order" in request.GET:
order = request.GET["order"]
if order != request.session["all_transactions_order"]:
if order != request.session.get("all_transactions_order", "default"):
request.session["all_transactions_order"] = order
transactions = Transaction.objects.prefetch_related(
@@ -339,6 +339,7 @@ def transaction_all_list(request):
"account__exchange_currency",
"account__currency",
"installment_plan",
"entities",
).all()
transactions = default_order(transactions, order=order)

View File

@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-28 00:49+0000\n"
"PO-Revision-Date: 2025-01-27 13:27-0300\n"
"Last-Translator: Herculino Trotta\n"
"PO-Revision-Date: 2025-01-29 06:12+0100\n"
"Last-Translator: Dimitri Decrock <dimitri@fam-decrock.eu>\n"
"Language-Team: \n"
"Language: nl\n"
"MIME-Version: 1.0\n"
@@ -323,8 +323,6 @@ msgid "Info"
msgstr "Info"
#: apps/common/views.py:110
#, fuzzy
#| msgid "Category updated successfully"
msgid "Cache cleared successfully"
msgstr "Categorie succesvol bijgewerkt"
@@ -1180,7 +1178,7 @@ msgstr "Tijdsnotatie"
#: apps/users/forms.py:102 apps/users/models.py:48
msgid "Number Format"
msgstr "Nummerformat"
msgstr "Schrijfwijze Nummers"
#: apps/users/forms.py:131
msgid "Save"
@@ -1906,8 +1904,6 @@ msgid "Settings"
msgstr "Instellingen"
#: templates/includes/navbar/user_menu.html:38
#, fuzzy
#| msgid "Clear"
msgid "Clear cache"
msgstr "Leegmaken"

View File

@@ -44,53 +44,10 @@
</div>
{# Action buttons#}
<div class="col-12 col-xl-8">
<div class="d-grid gap-2 d-xl-flex justify-content-xl-end">
<button class="btn btn-sm btn-outline-success"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_income from:window"
hx-vals='{"year": {{ year }}, "month": {{ month }}, "type": "IN"}'>
<i class="fa-solid fa-arrow-right-to-bracket me-2"></i>
{% translate "Income" %}
</button>
<button class="btn btn-sm btn-outline-danger"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_expense from:window"
hx-vals='{"year": {{ year }}, "month": {{ month }}, "type": "EX"}'>
<i class="fa-solid fa-arrow-right-from-bracket me-2"></i>
{% translate "Expense" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'installment_plan_add' %}"
hx-trigger="click, installment from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-divide me-2"></i>
{% translate "Installment" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'recurring_transaction_add' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-repeat me-2"></i>
{% translate "Recurring" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'transactions_transfer' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_transfer from:window"
hx-vals='{"year": {{ year }}, "month": {{ month }}}'>
<i class="fa-solid fa-money-bill-transfer me-2"></i>
{% translate "Transfer" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'account_reconciliation' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-scale-balanced me-2"></i>
{% translate "Balance" %}
</button>
</div>
<c-ui.quick-transactions-buttons
:year="year"
:month="month"
></c-ui.quick-transactions-buttons>
</div>
</div>
<div class="row">

View File

@@ -1,3 +1,4 @@
{% load markdown %}
{% load i18n %}
<div class="transaction d-flex my-1 {% if transaction.type == "EX" %}expense{% else %}income{% endif %}">
{% if not disable_selection %}
@@ -54,7 +55,7 @@
{% if transaction.notes %}
<div class="row mb-2 mb-lg-1 tw-text-gray-400">
<div class="col-auto pe-1"><i class="fa-solid fa-align-left fa-fw me-1 fa-xs"></i></div>
<div class="col ps-0">{{ transaction.notes | linebreaksbr }}</div>
<div class="col ps-0">{{ transaction.notes | limited_markdown | linebreaksbr }}</div>
</div>
{% endif %}
{# Category#}

View File

@@ -3,7 +3,7 @@
<i class="{{ icon }}"></i>
</div>
<div class="card-body">
<h5 class="tw-text-{{ color }}-400 fw-bold" {{ attrs }}>{{ title }}{% if help_text %}{% include 'includes/help_icon.html' with content=help_text %}{% endif %}</h5>
<h5 class="tw-text-{{ color }}-400 fw-bold tw-mr-[50px]" {{ attrs }}>{{ title }}{% if help_text %}{% include 'includes/help_icon.html' with content=help_text %}{% endif %}</h5>
{{ slot }}
</div>
</div>

View File

@@ -0,0 +1,50 @@
{% load i18n %}
<div class="d-grid gap-2 d-xl-flex justify-content-xl-end">
<div class="d-grid gap-2 d-xl-flex flex-wrap justify-content-xl-center">
<button class="btn btn-sm btn-outline-success"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_income from:window"
hx-vals='{"year": {{ year }}, {% if month %}"month": {{ month }},{% endif %} "type": "IN"}'>
<i class="fa-solid fa-arrow-right-to-bracket me-2"></i>
{% translate "Income" %}
</button>
<button class="btn btn-sm btn-outline-danger"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_expense from:window"
hx-vals='{"year": {{ year }}, {% if month %}"month": {{ month }},{% endif %} "type": "EX"}'>
<i class="fa-solid fa-arrow-right-from-bracket me-2"></i>
{% translate "Expense" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'installment_plan_add' %}"
hx-trigger="click, installment from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-divide me-2"></i>
{% translate "Installment" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'recurring_transaction_add' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-repeat me-2"></i>
{% translate "Recurring" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'transactions_transfer' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_transfer from:window"
hx-vals='{"year": {{ year }} {% if month %}, "month": {{ month }}{% endif %}}'>
<i class="fa-solid fa-money-bill-transfer me-2"></i>
{% translate "Transfer" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'account_reconciliation' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-scale-balanced me-2"></i>
{% translate "Balance" %}
</button>
</div>
</div>

View File

@@ -1,3 +1,4 @@
{% load settings %}
{% load i18n %}
<div class="dropdown">
<a class="tw-text-2xl" type="button" data-bs-toggle="dropdown" aria-expanded="false">
@@ -40,5 +41,7 @@
</li>
<li><a class="dropdown-item" href="{% url 'logout' %}"><i class="fa-solid fa-door-open me-2 fa-fw"></i
>{% translate 'Logout' %}</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="https://github.com/eitchtee/WYGIWYH/releases" target="_blank" rel="nofollow">v. {% settings "APP_VERSION" %}</a></li>
</ul>
</div>

View File

@@ -44,53 +44,10 @@
</div>
{# Action buttons#}
<div class="col-12 col-xl-8">
<div class="d-grid gap-2 d-xl-flex justify-content-xl-end">
<button class="btn btn-sm btn-outline-success"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_income from:window"
hx-vals='{"year": {{ year }}, "month": {{ month }}, "type": "IN"}'>
<i class="fa-solid fa-arrow-right-to-bracket me-2"></i>
{% translate "Income" %}
</button>
<button class="btn btn-sm btn-outline-danger"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_expense from:window"
hx-vals='{"year": {{ year }}, "month": {{ month }}, "type": "EX"}'>
<i class="fa-solid fa-arrow-right-from-bracket me-2"></i>
{% translate "Expense" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'installment_plan_add' %}"
hx-trigger="click, installment from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-divide me-2"></i>
{% translate "Installment" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'recurring_transaction_add' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-repeat me-2"></i>
{% translate "Recurring" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'transactions_transfer' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_transfer from:window"
hx-vals='{"year": {{ year }}, "month": {{ month }}}'>
<i class="fa-solid fa-money-bill-transfer me-2"></i>
{% translate "Transfer" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'account_reconciliation' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-scale-balanced me-2"></i>
{% translate "Balance" %}
</button>
</div>
<c-ui.quick-transactions-buttons
:year="year"
:month="month"
></c-ui.quick-transactions-buttons>
</div>
</div>
{# Monthly summary#}

View File

@@ -39,53 +39,10 @@
</div>
{# Action buttons#}
<div class="col-12 col-xl-10">
<div class="d-grid gap-2 d-xl-flex justify-content-xl-end">
<button class="btn btn-sm btn-outline-success"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_income from:window"
hx-vals='{"year": {{ year }}, "type": "IN"}'>
<i class="fa-solid fa-arrow-right-to-bracket me-2"></i>
{% translate "Income" %}
</button>
<button class="btn btn-sm btn-outline-danger"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_expense from:window"
hx-vals='{"year": {{ year }}, "type": "EX"}'>
<i class="fa-solid fa-arrow-right-from-bracket me-2"></i>
{% translate "Expense" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'installment_plan_add' %}"
hx-trigger="click, installment from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-divide me-2"></i>
{% translate "Installment" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'recurring_transaction_add' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-repeat me-2"></i>
{% translate "Recurring" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'transactions_transfer' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_transfer from:window"
hx-vals='{"year": {{ year }}}'>
<i class="fa-solid fa-money-bill-transfer me-2"></i>
{% translate "Transfer" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'account_reconciliation' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-scale-balanced me-2"></i>
{% translate "Balance" %}
</button>
</div>
<c-ui.quick-transactions-buttons
:year="year"
:month="month"
></c-ui.quick-transactions-buttons>
</div>
</div>
<div class="row">

View File

@@ -41,53 +41,10 @@
</div>
{# Action buttons#}
<div class="col-12 col-xl-10">
<div class="d-grid gap-2 d-xl-flex justify-content-xl-end">
<button class="btn btn-sm btn-outline-success"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_income from:window"
hx-vals='{"year": {{ year }}, "type": "IN"}'>
<i class="fa-solid fa-arrow-right-to-bracket me-2"></i>
{% translate "Income" %}
</button>
<button class="btn btn-sm btn-outline-danger"
hx-get="{% url 'transaction_add' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_expense from:window"
hx-vals='{"year": {{ year }}, "type": "EX"}'>
<i class="fa-solid fa-arrow-right-from-bracket me-2"></i>
{% translate "Expense" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'installment_plan_add' %}"
hx-trigger="click, installment from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-divide me-2"></i>
{% translate "Installment" %}
</button>
<button class="btn btn-sm btn-outline-warning"
hx-get="{% url 'recurring_transaction_add' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-repeat me-2"></i>
{% translate "Recurring" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'transactions_transfer' %}"
hx-target="#generic-offcanvas"
hx-trigger="click, add_transfer from:window"
hx-vals='{"year": {{ year }}}'>
<i class="fa-solid fa-money-bill-transfer me-2"></i>
{% translate "Transfer" %}
</button>
<button class="btn btn-sm btn-outline-info"
hx-get="{% url 'account_reconciliation' %}"
hx-trigger="click, balance from:window"
hx-target="#generic-offcanvas">
<i class="fa-solid fa-scale-balanced me-2"></i>
{% translate "Balance" %}
</button>
</div>
<c-ui.quick-transactions-buttons
:year="year"
:month="month"
></c-ui.quick-transactions-buttons>
</div>
</div>
<div class="row">

View File

@@ -10,6 +10,9 @@ RUN pip wheel --wheel-dir /usr/src/app/wheels -r requirements.txt
FROM python:3.11-slim-bookworm AS python-run-stage
ARG VERSION=dev
ENV APP_VERSION=$VERSION
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE=1 \

View File

@@ -18,6 +18,10 @@ RUN --mount=type=cache,target=/root/.npm \
npm run build
FROM python:3.11-slim-bookworm AS python-run-stage
ARG VERSION=dev
ENV APP_VERSION=$VERSION
COPY --from=webpack_build /usr/src/frontend/build /usr/src/frontend/build
WORKDIR /usr/src/app

View File

@@ -26,3 +26,4 @@ python-dateutil~=2.9.0.post0
simpleeval~=1.0.0
pydantic~=2.10.5
PyYAML~=6.0.2
mistune~=3.1.1